/* The brand's touches on the table's chrome. The colours come from the brand layer
   (theme/table_<brand>.scss, loaded before the table CSS) through the --table-* tokens; this file
   adds what tokens can't, keyed on <html data-table-brand="phasesix|nexus|tirakan">. PhaseSix,
   the neutral toolkit, keeps the table's own shapes. The board (cloth, objects, fog, token rings)
   looks the same in every brand. */

/* ---- Heading font --------------------------------------------------------------------------- */

/* The brand's heading font (Oxanium for Nexus, Morris Roman for Tirakan) on the real headings:
   large enough and in mixed case. The small uppercase labels (.table-panel__title, the popups'
   heads) keep the body font, where Morris Roman capitals would be hard to read. */
.table-gminfo-card__title,
.table-gminfo-card__body h1,
.table-gminfo-card__body h2,
.table-gminfo-card__body h3,
.table-gminfo-card__body h4,
.table-gminfo-card__body h5,
.table-initiative__title,
.table-marker-picker__title,
.table-showcase__name {
  font-family: var(--table-heading-font, inherit);
}

/* ---- Nexus: sharp, chamfered panels and a glow on the accent edge ---------------------------- */

/* Oxanium stays readable in small capitals: the labels take it too. */
[data-table-brand="nexus"] .table-panel__title,
[data-table-brand="nexus"] .table-views__head,
[data-table-brand="nexus"] .table-menu__heading,
[data-table-brand="nexus"] .table-presence__title,
[data-table-brand="nexus"] .table-looks__title,
[data-table-brand="nexus"] .table-dice-prefs__heading,
[data-table-brand="nexus"] .table-character-panel__title {
  font-family: var(--table-heading-font, inherit);
  letter-spacing: 0.08em;
}

/* Two corners cut off: top left and bottom right on the HUD bar and toasts. Menus and panels
   scroll, and their scrollbar runs down the right edge, so they lose the two left corners
   instead and the scrollbar keeps its ends. */
[data-table-brand="nexus"] .table-menu,
[data-table-brand="nexus"] .table-hud__bar,
[data-table-brand="nexus"] .table-toast,
[data-table-brand="nexus"] .table-panel {
  --nexus-cut: 9px;
  --nexus-edge: rgba(var(--table-accent-rgb), 0.6);
}

/* Browsers with corner-shape (Chromium): a bevel instead of a radius. The border follows it and
   the box shadows (the access dialog's glow) stay, since nothing is clipped. */
@supports (corner-shape: bevel) {
  [data-table-brand="nexus"] .table-hud__bar,
  [data-table-brand="nexus"] .table-toast {
    border-radius: var(--nexus-cut) 0;
    corner-shape: bevel;
  }

  [data-table-brand="nexus"] .table-menu,
  [data-table-brand="nexus"] .table-panel {
    border-radius: var(--nexus-cut) 0 0 var(--nexus-cut);
    corner-shape: bevel;
  }
}

/* Without it (Firefox, Safari): a clip-path. It takes the border and the box shadows along, so
   the cut edges are drawn as gradient lines in the corners. */
@supports not (corner-shape: bevel) {
  [data-table-brand="nexus"] .table-menu,
  [data-table-brand="nexus"] .table-hud__bar,
  [data-table-brand="nexus"] .table-toast,
  [data-table-brand="nexus"] .table-panel {
    border-radius: 0;
    background-repeat: no-repeat;
    background-size: var(--nexus-cut) var(--nexus-cut);
    background-origin: border-box;
  }

  [data-table-brand="nexus"] .table-hud__bar,
  [data-table-brand="nexus"] .table-toast {
    clip-path: polygon(
      var(--nexus-cut) 0,
      100% 0,
      100% calc(100% - var(--nexus-cut)),
      calc(100% - var(--nexus-cut)) 100%,
      0 100%,
      0 var(--nexus-cut)
    );
    background-image:
      linear-gradient(to bottom right, transparent 50%, var(--nexus-edge) 50%, var(--nexus-edge) 62%, transparent 62%),
      linear-gradient(to top left, transparent 50%, var(--nexus-edge) 50%, var(--nexus-edge) 62%, transparent 62%);
    background-position:
      top left,
      bottom right;
  }

  [data-table-brand="nexus"] .table-menu,
  [data-table-brand="nexus"] .table-panel {
    clip-path: polygon(
      var(--nexus-cut) 0,
      100% 0,
      100% 100%,
      var(--nexus-cut) 100%,
      0 calc(100% - var(--nexus-cut)),
      0 var(--nexus-cut)
    );
    background-image:
      linear-gradient(to bottom right, transparent 50%, var(--nexus-edge) 50%, var(--nexus-edge) 62%, transparent 62%),
      linear-gradient(to top right, transparent 50%, var(--nexus-edge) 50%, var(--nexus-edge) 62%, transparent 62%);
    background-position:
      top left,
      bottom left;
  }
}

/* The GM info card keeps its corners (the beak to the pin sits outside it) and glows. */
[data-table-brand="nexus"] .table-gminfo-card {
  border-radius: 2px;
  box-shadow:
    0 -1px 14px rgba(var(--table-accent-rgb), 0.35),
    0 0 2.5rem rgba(var(--table-accent-rgb), 0.12),
    0 18px 50px rgba(var(--table-black-rgb), 0.6);
}

[data-table-brand="nexus"] .table-gminfo-card__title {
  letter-spacing: 0.02em;
}

[data-table-brand="nexus"] .table-gminfo-card__sigil {
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(var(--table-accent-rgb), 0.35);
}

/* ---- Tirakan: soft asymmetric corners and one slim curved line -------------------------------- */

[data-table-brand="tirakan"] .table-menu,
[data-table-brand="tirakan"] .table-hud__bar,
[data-table-brand="tirakan"] .table-toast,
[data-table-brand="tirakan"] .table-panel {
  border-radius: 1rem 0.3rem;
}

[data-table-brand="tirakan"] .table-gminfo-card {
  border-top-width: 1px;
  border-radius: 1.4rem 0.35rem;
}

/* The ornament: a thin line curving around the card's top-left corner, from the primary colour. */
[data-table-brand="tirakan"] .table-gminfo-card::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 5px;
  width: 4.5rem;
  height: 1.5rem;
  border-top: 1px solid rgba(var(--table-accent-rgb), 0.55);
  border-left: 1px solid rgba(var(--table-accent-rgb), 0.3);
  border-radius: 1.2rem 0 0;
  pointer-events: none;
}

[data-table-brand="tirakan"] .table-gminfo-card__title {
  font-size: 19px;
  font-weight: 400;
}
