src/components/card/card.module.css
/**
 * Layout
 */

.container {
  --card-text-size-sm: var(--text-sm);
  --card-text-size: var(--text-base);
  --card-title-size: var(--text-lg);
  --card-spacing: 1rem;
  font-family: var(--font-family-content);
  text-align: center;
}

.card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto auto;
  gap: var(--card-spacing);
  grid-template-areas:
    "header"
    "image"
    "pre"
    "content";
  width: 100%;
  background: var(--palette-point-five);
  border: 1px solid var(--palette-1);
  border-radius: var(--rounded);
  padding-bottom: var(--card-spacing);
  text-align: left;

  &:not(.has-image) {
    grid-template-columns: 1fr;
  }
}

.card > * {
  padding-left: var(--card-spacing);
  padding-right: var(--card-spacing);
}

.container.full .card {
  @container (min-width: 33.5rem) {
    grid-template-columns: 10fr 6fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "header header"
      "pre image"
      "content image";
  }
}

.container.full .card.sideways {
  @container (min-width: 33.5rem) {
    grid-template-columns: 9fr 7fr;
  }
}

.container.full .card.back:not(.back-has-header) {
  @container (min-width: 33.5rem) {
    padding: var(--card-spacing) 0;
    grid-template-rows: 1fr;
    grid-template-areas: "content image";
  }
}

.container.compact .card {
  @container (min-width: 24rem) {
    grid-template-columns: 1fr 8rem;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "header header"
      "pre image"
      "content content";
  }

  @container (min-width: 32rem) {
    grid-template-columns: 1fr 8rem;
    grid-template-areas:
      "header header"
      "pre image"
      "content image";
  }
}

.container.compact .card.back:not(.back-has-header) {
  padding: var(--card-spacing) 0;
  grid-template-rows: 1fr;
  grid-template-areas: "content image";
}

.container.tooltip {
  --card-text-size-sm: var(--text-xs);
  --card-text-size: var(--text-sm);
  --card-title-size: var(--text-base);
  --card-spacing: 0.75rem;
}

.container.tooltip .card {
  grid-template-rows: auto auto 1fr;
  grid-template-columns: 1fr 6rem;

  grid-template-areas:
    "header header"
    "pre image"
    "content content";
}

.container.tooltip .card.back:not(.has-image) {
  grid-template-columns: 1fr;
  padding: 0 0 var(--card-spacing) 0;
  grid-template-rows: auto 1fr;
  grid-template-areas: "header" "content";
}

.container.tooltip .card.back:not(.back-has-header) {
  padding: var(--card-spacing) 0;
  grid-template-rows: 1fr;
  grid-template-areas: "content image";
}

.container.tooltip .card.back:not(.has-image):not(.back-has-header) {
  grid-template-columns: 1fr;
  padding: var(--card-spacing) 0;
  grid-template-rows: 1fr;
  grid-template-areas: "content";
}

.container:not(.tooltip) > * + * {
  margin-top: 0.5rem;
}

.pre {
  grid-area: pre;
}

.pre > * + * {
  margin-top: var(--card-spacing);
}

.content {
  grid-area: content;
}

.content > * + * {
  margin-top: var(--card-spacing);
}

.image {
  grid-area: image;
}

.image img {
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.container.compact
  .image
  :where([data-component="card-scan"], [data-component="card-thumbnail"]) {
  max-width: 100%;
  width: 8rem;
  height: auto;
}

.container.full
  .image
  :where([data-component="card-scan"], [data-component="card-thumbnail"]) {
  max-width: 100%;
  width: 16rem;
  height: auto;
}

.container.full
  .card.sideways
  .image
  :where([data-component="card-scan"], [data-component="card-thumbnail"]) {
  max-width: 100%;
  width: 20rem;
  height: auto;
}

/* Elements */

.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--card-spacing);
  padding: calc(var(--card-spacing) / 2) var(--card-spacing);
  color: var(--nord-6);
  border-radius: calc(var(--rounded) - 1px) calc(var(--rounded) - 1px) 0 0;
}

.header > * {
  z-index: 2;
}

.header a {
  &:hover {
    text-decoration: underline;
  }
}

.header-row {
  display: flex;
  align-items: center;
  gap: var(--card-spacing);
}

.header-titles {
  flex: 1 1 auto;
}

.header-extras {
  flex: 0 0 auto;
}

.header-icon {
  font-size: calc(var(--card-title-size) * 1.75);
  color: currentColor;
  line-height: 1;

  & > img {
    width: 100%;
    height: auto;
  }
}

.faction-icons {
  font-size: calc(var(--card-title-size) * 1.5);
  gap: 0.25rem;
}

.name-row {
  flex: 1 1 auto;
}

.name {
  font-size: var(--card-title-size);
}

/** Workaround Safari bug where it does not correctly wrap text when svg is present (unique icon) */
.name-inner {
  display: inline-flex;
  align-items: baseline;
}

.name .unique svg {
  display: inline;
}

.name button,
.name a,
.name span {
  font-weight: 700;
  font-family: var(--font-family-content);
  background: none;
  color: currentColor;
  text-decoration: none;
  text-shadow: inherit;

  &:hover:not(span),
  &:focus:not(span) {
    text-decoration: underline;
  }
}

.name .parallel {
  display: inline;
  vertical-align: baseline;
  font-size: var(--text-sm);
}

.sub {
  font-family: var(--font-family-content);
  font-style: italic;
  font-weight: 400;
  font-size: var(--card-text-size);
}

.icons > * + * {
  margin-top: var(--card-spacing);
}

.icons-skills {
  gap: 0.375rem;
}

.icons-skill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  background: var(--palette-2);
  border-radius: var(--rounded);
  font-size: calc(var(--card-text-size, var(--text-sm)) * 1.375);
}

.icons-damage {
  display: flex;
  align-items: center;
  flex-flow: row nowrap;
  gap: 0.5rem;
  font-size: var(--icon-lg);
}

.text {
  padding-left: calc(var(--card-spacing, 1rem) / 1.5);
  border-left-width: 2px;
  border-left-style: solid;
  border-color: var(--text);
  font-family: var(--font-family-content);
  font-size: var(--card-text-size, var(--text-sm));
  text-align: left;
}

.text > * + * {
  margin-top: var(--card-spacing);
}

.text p {
  max-width: 60ch;
}

.text b {
  color: var(--palette-6);
  font-weight: 700;
}

.text img {
  display: inline-block;
}

.text img:not([width]) {
  width: 1em;
}

.flavor {
  font-size: var(--card-text-size-sm);
  max-width: 60ch;
  font-style: italic;
  text-align: left;
}

.flavor :where(i, em) {
  font-style: normal;
}

.meta:not(.tooltip) {
  border-top: 1px solid var(--text);
  padding-top: 0.25rem;
}

.meta-property {
  font-size: var(--text-xs);
}

.meta-property [class^="encounters-"],
.meta-property svg {
  display: inline-block;
  vertical-align: baseline;
}

.meta-property strong {
  font-weight: 700;
}

.details {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--card-spacing);
  line-height: 1;
}

.details-text {
  font-size: var(--card-text-size-sm);
  font-family: var(--font-family-content);
}

.details-text > * + * {
  margin-top: 0.25rem;
}

.details-traits {
  font-style: italic;
  font-weight: 700;
}

.details-type {
  font-weight: 700;
}

.details-type > *:not(:last-child)::after {
  content: " · ";
}

.unique {
  fill: currentColor;
  font-size: 0.625rem;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.2));
  flex: 0 0 auto;
}

.taboo-chain i {
  margin-right: 0.25rem;
}

:lang(ko, zh, zh-Hant, zh-Hans) :where(.sub) {
  font-style: normal;
}
