/* Copyright (C) 2023 Admix Pty. Ltd. - All Rights Reserved.
Unauthorized copying of this file, via any medium is strictly prohibited.
Proprietary and confidential. */

setup-direction {
  alpha-mode: opaque;
  texture: none;
  lighting: lit;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 0%;
  color: #d4f1ff;
}
.check setup-direction,
setup-direction.check {
  lighting: lit;
}

cone {
  alpha-mode: opaque;
  texture: none;
  color: #d4f1ff;
  lighting: lit;
  reverse: visible;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 10%;
}

stock {
  alpha-mode: blend;
  color: purple;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 10%;
  lighting: lit;
  opacity: 60%;
}

curve {
  curve-mesh-style: pixel-line;
}

.cutting .selected-toolpath {
  alpha-mode: opaque;
  texture: none;
  color: darkorange;
}

.linking .selected-toolpath {
  alpha-mode: opaque;
  texture: none;
  color: darkcyan;
}

.base surface {
  alpha-mode: opaque;
  opacity: 100%;
  reverse: hidden;
}

.base curve {
  color: #333;
  alpha-mode: opaque;
  opacity: 100%;
}

.base_transp_surf_only surface,
.base_transparency surface {
  color: white;
  alpha-mode: blend;
  opacity: 15%;
}

.base_transp_curv_only curve,
.base_transparency curve {
  color: black;
  alpha-mode: blend;
  opacity: 15%;
}

surface.wireframe,
.hidden {
  visibility: hidden;
  pointer-events: none;
}

.base_transparency > surface.active {
  color: white;
  alpha-mode: blend;
  opacity: 20%;
}

surface.active {
  /* bad: we don't know that it's aluminium. */
  texture: aluminum;
  alpha-mode: opaque;
  opacity: 100%;
}

curve.active {
  color: #333;
  alpha-mode: opaque;
  opacity: 100%;
}

/* Materials. See https://google.github.io/filament/Material%20Properties.pdf for reference. */

.mat-plastic {
  texture: none;
  /* make sure it's not black, at least. texture resets color */
  color: white;
  /* add lights back */
  lighting: lit;
  perceptual-roughness: 30%;
  reflectance: 30%;
  metallic: 0%;
}
.mat-aluminum,
.mat-aluminum surface {
  texture: aluminum;
}
.mat-steel,
.mat-steel surface {
  texture: iron;
}

/* color is inherited by default, but these rules mean datums show up in their own color */

datum-plane {
  color: #0ea5e9;
}
datum-line {
  color: #0284c7;
}

point {
  color: #0369a1;
  reverse: visible;
}

line {
  color: #0284c7;
}

surface-normal {
  color: purple;
}

/**
 * Utility classes
 */

/* Helper classes to apply pointer-events, matching tailwind's classes */
.pointer-events-none {
  pointer-events: none;
}
.pointer-events-auto {
  pointer-events: auto;
}
surface.rev-vis {
  reverse: visible;
}
surface.rev-hid {
  reverse: hidden;
}
/**
 * TOOLS; Inspect, Measure, Entity Select
 * =======
 */

.base-inspect surface:hover,
.base-inspect surface:active {
  texture: none;
  alpha-mode: opaque;
  opacity: 100%;
  reverse: visible;
}

surface.inspect {
  opacity: 100%;
  reverse: visible;
  color: #0490d1;
}
.inspect-outline {
  opacity: 100%;
  color: red;
}

.base-inspect surface,
surface.inspect {
  cursor: help;
}

.base.base-inspect surface:hover,
surface.inspect:hover {
  color: #4aabd9;
}
.base-inspect surface:active,
surface.inspect:active {
  color: #85c7e5;
}

/* line, point, other atoms */
.measure {
  alpha-mode: opaque;
  opacity: 100%;
  color: red;
}
surface.measure {
  alpha-mode: opaque;
  lighting: unlit;
  opacity: 100%;
}

.base-measurement surface:hover,
.base-measurement surface:active,
surface.measure:hover {
  texture: none;
  opacity: 100%;
  alpha-mode: opaque;
  cursor: cell;
}

.base-measurement surface:hover {
  color: #4aabd9;
}
.base-measurement surface:active {
  color: #85c7e5;
}
/* clicking makes it darker on one that's already active. */
surface.measure:hover {
  color: #0490d1;
}
surface.measure:active {
  color: #1c6282;
}

/* Same color made the most sense. */
surface.measure_incomplete {
  color: #0490d1;
}
surface.measure_complete {
  color: #0490d1;
}
.base-selection surface {
  lighting: lit;
  texture: none;
  opacity: 30%;
  color: #aaaaaa;
  alpha-mode: blend;
  reverse: hidden;
}
.base-selection .chain-group:hover surface,
.base-selection surface.hovered,
.base-selection surface:hover {
  opacity: 100%;
  alpha-mode: opaque;
}
.base-selection surface:active {
  opacity: 100%;
  color: #89fecb;
  alpha-mode: opaque;
}
surface.entity_selected {
  opacity: 100%;
  alpha-mode: opaque;
  lighting: unlit;
  reverse: visible;
}
.entity_selected surface:hover {
  alpha-mode: opaque;
  lighting: unlit;
  reverse: visible;
}
surface.entity_selected.default-color {
  color: #2dba7d;
}

/* -------- BEGIN DEV MODE -------- */

surface.occluded {
  color: #cc5500;
}
.devmode > line {
  color: #667eea;
}

/* -------- END DEV MODE -------- */

/* Generally speaking, visibility is inherited, so if you have
 * <layer class="hidden">
 *   <layer class="momentary" group="A"></layer>
 * </layer>
 *
 * Then this works well -- focus(A) will make that layer visible.
 * 
 * A slight variation is this --
 *
 * <layer class="hidden momentary" group="B">
 *   <layer class="hidden momentary" group="A"></layer>
 * </layer>
 *
 * focus(A) still makes A visible, except focus(B) will now not make A visible.
 *
 */
.hidden {
  visibility: hidden;
}
.momentary:focus,
.momentary:identify {
  visibility: visible;
}

.warning_kind:focus *,
.warning_kind:identify * {
  visibility: visible;
}

.warning_kind {
  /* Default color of a highlighted warning surface */
  texture: none;
  color: #b91c1c;
  alpha-mode: opaque;
  reverse: visible;
}

.Long_Thin_Tool surface {
  /* Specialize color for a specific warning type */
  color: #075985;
}

.Thin_Wall surface {
  color: #047857;
}

.causes.sharp-internal-corner surface {
  alpha-mode: blend;
  opacity: 70%;
}
curve.causes.sharp-internal-corner,
.causes.sharp-internal-corner curve {
  curve-mesh-style: tube;
  curve-mesh-scaling: 2;
  color: red;
  alpha-mode: opaque;
  opacity: 100%;
}

/* ------------------- DFM Mode ------------------- */
/* The "all_setups" class is mutually exclusive with the "setups_are_translucent" class, so they don't
need to share a selector specification */
.all_setups surface,
.only_some_setups surface {
  reverse: visible;
  alpha-mode: opaque;
  texture: none;
  lighting: lit;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 0%;
}
.only_some_setups.setups_are_translucent surface {
  reverse: visible;
  lighting: lit;
  alpha-mode: blend;
  opacity: 25%;
}


/* Checks
 * =======
*/
/* sev-etc = CheckSeverity::fog_class() */

/* :hover styles = bump the lightness in HSL color space. Looks vaguely ok.
 * :active styles = bump even further. */

.check {
  cursor: pointer;
}

.check setup-direction {
  color: inherit;
}

.check.sev-critical {
  color: #b91c1c;
}
.check.sev-critical:hover {
  color: #ed8888;
}
.check.sev-critical:active {
  color: #f3afaf;
}

.check.sev-warn {
  color: #e09f4c;
}
.check.sev-warn:hover {
  color: #e8b97d;
}
.check.sev-warn:active {
  color: #f2d7b5;
}

.check.sev-suggestion {
  color: #1e40af;
}
.check.sev-suggestion:hover {
  color: #7c96e9;
}
.check.sev-suggestion:active {
  color: #a3b6f0;
}

.check.sev-good {
  /* AI-NC darker green */
  color: #226253;
  /* AI-NC lighter green */
  color: #63a696;
  /* accent from tailwind.config.js */
  color: #6ee7b7;
  /* a random green? */
  color: #2dba7d;
}
.check.sev-good:hover {
  color: #89ebc4;
}
.check.sev-good:active {
  color: #c2f5e0;
}

.check.sharp-internal-corner surface {
  alpha-mode: blend;
  opacity: 60%;
  reverse: visible;
}

.check.sharp-internal-corner curve {
  curve-mesh-style: tube;
  curve-mesh-scaling: 2;
  color: red;
  alpha-mode: opaque;
  opacity: 100%;
}

/* Checks that got clicked */
.check-detail .sev-critical {
  color: #e96d6d;
}
.check-detail .sev-warn {
  color: orange;
}
.check-detail .sev-suggestion {
  color: blue;
}
.check-detail .sev-good {
  color: green;
  /* accent from tailwind.config.js */
  color: #6ee7b7;
}

.check-more-detail {
  visibility: hidden;
}
.hovered-check .check-more-detail,
.check:hover .check-more-detail {
  visibility: visible;
  alpha-mode: blend;
  opacity: 80%;
}
.check-detail .check-more-detail,
.check:active .check-more-detail {
  visibility: visible;
  alpha-mode: opaque;
}

.check_atom.imaginary {
  pointer-events: none;
  alpha-mode: blend;
  lighting: lit;
  opacity: 60%;
}
setup-direction.imaginary {
  reverse: hidden;
  opacity: 40%;
}
.check .check_atom.imaginary {
  visibility: hidden;
}
.hovered-check .check_atom.imaginary,
.check:hover .check_atom.imaginary,
.check:active .check_atom.imaginary,
.check-detail .check_atom.imaginary {
  visibility: visible;
}

/* Heatmap
 * =======
*/

.heatmap > surface.heatmap-unknown {
  /* */
}

.heatmap > surface.heatmap-100 {
  color: #63b682;
}
.heatmap > surface.heatmap-200 {
  color: #73b87e;
}
.heatmap > surface.heatmap-300 {
  color: #84bb7b;
}
.heatmap > surface.heatmap-400 {
  color: #94bd77;
}
.heatmap > surface.heatmap-500 {
  color: #a4c073;
}
.heatmap > surface.heatmap-600 {
  color: #b0be6e;
}
.heatmap > surface.heatmap-700 {
  color: #c4c56d;
}
.heatmap > surface.heatmap-800 {
  color: #d4c86a;
}
.heatmap > surface.heatmap-900 {
  color: #e2c965;
}
.heatmap > surface.heatmap-1000 {
  color: #f5ce62;
}
.heatmap > surface.heatmap-1100 {
  color: #f3c563;
}
.heatmap > surface.heatmap-1200 {
  color: #e9b861;
}
.heatmap > surface.heatmap-1300 {
  color: #e6ad61;
}
.heatmap > surface.heatmap-1400 {
  color: #ecac67;
}
.heatmap > surface.heatmap-1500 {
  color: #e9a268;
}
.heatmap > surface.heatmap-1600 {
  color: #e79a69;
}
.heatmap > surface.heatmap-1700 {
  color: #e5926b;
}
.heatmap > surface.heatmap-1800 {
  color: #e2886c;
}
.heatmap > surface.heatmap-1900 {
  color: #e0816d;
}
.heatmap > surface.heatmap-2000 {
  color: #dd776e;
}

/* ------------------- Styles for the production setup map ------------------- */
.production-setups surface.base {
  alpha-mode: opaque;
  texture: none;
  lighting: lit;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 0%;
  reverse: visible;
  color: #c5d2d8;
}

.production-setups curve.base {
  lighting: unlit;
}

.production-setups surface.missing {
  color: #484d50;
}

.production-setups.allow-prod-transparency .opacity-20 {
  opacity: 20%;
  alpha-mode: blend;
  lighting: unlit;
  reverse: hidden;
}

.production-setups.allow-prod-transparency .opacity-50 {
  opacity: 50%;
  alpha-mode: blend;
  lighting: unlit;
  reverse: hidden;
}

.production-setups.allow-prod-transparency .opacity-70 {
  opacity: 70%;
  alpha-mode: blend;
  lighting: unlit;
  reverse: hidden;
}

.production-setups.allow-prod-transparency .opacity-90 {
  opacity: 90%;
  alpha-mode: blend;
  lighting: unlit;
  reverse: hidden;
}
.production-setups.allow-prod-transparency .color-inherit {
  pointer-events: none;
}
.production-setups .color-inherit {
  color: inherit;
}

/* ------------------- Setup Preflight Config ------------------- */
/* === Base Layer Style === */
/* surfaces */
.base .s-config surface.base {
  alpha-mode: opaque;
  texture: none;
  lighting: unlit;
  reverse: visible;
  color: #9aa4a8;
}
.base .s-config curve.base {
  color: #000;
}
.base .s-config surface.base:hover {
  color: #bec9ce;
}

.base .s-config surface.s-select {
  color: #0490d1;
}
.base .s-config surface.s-select:hover {
  color: #4aabd9;
}
.base .s-config.s-hidden surface.base {
  visibility: hidden;
}
.base .s-config .s-excepted surface.base {
  color: orange;
  lighting: unlit;
}

.base .s-config .s-unreached surface.base {
  color: #333;
  lighting: unlit;
}
.base .s-config .s-unreached surface.base:hover {
  color: #4d4d4d;
}

/* === Presentation Styles === */
/* Styles for setups */
.preflight.setup-config setup-direction.setup-s.preflight-s {
  color: #333;
  pointer-events: auto;
  lighting: lit;
}
surface.setup-config,
.setup-config surface {
  lighting: lit;
  texture: aluminum;
  alpha-mode: opaque;
  reverse: visible;
}
.preflight.setup-config setup-direction.setup-s.preflight-s.pointer-events-none {
  pointer-events: none;
}
.preflight.setup-config setup-direction.setup-s.preflight-s.s-show-full {
  alpha-mode: opaque;
  opacity: 100%;
}
.preflight.setup-config setup-direction.setup-s.preflight-s.s-show-partial {
  alpha-mode: blend;
  opacity: 30%;
}
.preflight.setup-config setup-direction.s-hidden {
  pointer-events: none;
  visibility: hidden;
}
/*  Surfaces */
/* Give this one a big specificity so it cna overule any 
individual setup id color assignment that might affect these
qualities */
.preflight.setup-config .hovered surface.setup-s.preflight-s {
  texture: none;
  lighting: lit;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 0%;
  color: #888;
}
.allow-transparency
  .preflight.setup-config
  .hovered
  surface.setup-s.preflight-s {
  alpha-mode: multiply;
  opacity: 60%;
  lighting: unlit;
}
.presentation .s-display-group surface {
  texture: none;
  lighting: lit;
  perceptual-roughness: 100%;
  reflectance: 20%;
  metallic: 0%;
}
.presentation.allow-transparency .s-display-group surface {
  alpha-mode: multiply;
  opacity: 60%;
  lighting: unlit;
}
.presentation .s-group-reachable surface {
  color: #166534;
}
.presentation .s-group-unreachable surface {
  color: #991b1b;
}
.presentation .s-group-excepted surface {
  color: orange;
}
/* Curves */
.preflight.setup-config .hide curve.base {
  visibility: hidden;
}

/* -- Chimera and compare stuff -- */
/*
  although not much is needed.
  the "compare-surfs" and "compare-curves" classes are the ones that
  belong to the chimera model, the entities themselves have this class on them,
  they are also within a "chimera" layer.
  
  The entities that belong to the primary model will still have the "base" class,
  but will also be inside a layer with "chimera-base", if we need to apply changes.
  
  Other than those, the variants that might apply are; "full", "compare-transparency", "wireframe",
  and "hidden" (but the hidden ones are actually not rendered)
*/
surface.compare-transparency {
  pointer-events: none;
  alpha-mode: blend;
  opacity: 30%;
  lighting: unlit;
  reverse: hidden;
}

.chimera .compare-surfs {
  pointer-events: auto;
  alpha-mode: opaque;
  lighting: lit;
}
.chimera .compare-surfs.compare-transparency {
  pointer-events: none;
  alpha-mode: blend;
  lighting: unlit;
  opacity: 30%;
  reverse: hidden;
}
.chimera curve.compare-curves {
  color: #333;
  alpha-mode: opaque;
  opacity: 100%;
}
/* .chimera curve.compare-curves.wireframe {
  color: orange;
  curve-mesh-style: tube;
  curve-mesh-scaling: 2;
  alpha-mode: blend;
  opacity: 60%;
  float: top;
} */