/* =====================================================================================================================
   Appearance preview window (js/ui/pages/appearance.js, id 'appearance', layout 'single'). Page agent P-MISC-B.
   ap- prefix. Two columns on landscape (sample bay | controls), stacked on portrait (bay on top, controls scroll).
   ===================================================================================================================== */

.ap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: calc(18 * var(--u));
  min-height: 0;
  height: 100%;
}

/* ------------------------------------------------------------------------------------------------- sample bay */
.ap-bay {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(60% 55% at 50% 52%, var(--info-a10), transparent 70%),
    var(--grid-faint),
    var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ap-bay::after {
  content: "";
  position: absolute;
  inset: calc(8 * var(--u));
  pointer-events: none;
  --sl2: calc(22 * var(--u));
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) top left / var(--sl2) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) top left / 1px var(--sl2) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) top right / var(--sl2) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) top right / 1px var(--sl2) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) bottom left / var(--sl2) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) bottom left / 1px var(--sl2) no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) bottom right / var(--sl2) 1px no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) bottom right / 1px var(--sl2) no-repeat;
}
.ap-cam {
  flex: none;
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  padding: calc(16 * var(--u)) calc(22 * var(--u)) 0;
}
.ap-sample {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: calc(10 * var(--u)) calc(20 * var(--u));
}
.ap-svg {
  width: 100%;
  height: 100%;
  max-height: calc(520 * var(--u));
  filter: drop-shadow(0 calc(10 * var(--u)) calc(18 * var(--u)) rgba(0, 0, 0, 0.45));
}
.ap-plate {
  flex: none;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: calc(2 * var(--u));
  margin: 0 0 calc(18 * var(--u)) calc(22 * var(--u));
  padding: calc(6 * var(--u)) calc(12 * var(--u)) calc(7 * var(--u));
  background: linear-gradient(90deg, rgba(4, 7, 8, 0.72), rgba(4, 7, 8, 0.2));
  box-shadow: inset 2px 0 0 var(--accent);
}
.ap-plate b {
  font: 600 var(--fs-body) / 1.25 var(--f-head);
  color: var(--text);
}

/* ------------------------------------------------------------------------------------------------- controls */
.ap-ctl {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ap-banner {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  margin: 0 0 calc(12 * var(--u));
  padding: calc(9 * var(--u)) calc(12 * var(--u)) calc(9 * var(--u)) calc(18 * var(--u));
  background: linear-gradient(90deg, var(--accent-a16), transparent 70%), var(--panel-a72);
  box-shadow: inset 0 0 0 1px var(--accent-dim);
}
.ap-banner::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(6 * var(--u));
  background: var(--hazard);
}
.ap-bglyph {
  flex: none;
  color: var(--accent);
}
.ap-bglyph .gglyph {
  width: calc(28 * var(--u));
  height: calc(28 * var(--u));
}
.ap-banner > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ap-banner b {
  font: 600 var(--fs-sm) / 1.35 var(--f-head);
  color: var(--accent);
}
.ap-banner span {
  font-size: var(--fs-label);
  line-height: 1.45;
  color: var(--dim);
}
.ap-scroll {
  padding: calc(2 * var(--u)) calc(8 * var(--u)) calc(8 * var(--u)) calc(2 * var(--u));
}
.ap-scroll .ghead {
  margin: calc(4 * var(--u)) 0 calc(8 * var(--u));
}
.ap-scroll .ghead:not(:first-child) {
  margin-top: calc(16 * var(--u));
}
.ap-sws {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: calc(8 * var(--u));
  padding: calc(4 * var(--u));
}
.ap-sw {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: calc(5 * var(--u));
  padding: 0;
  border: 0;
  background: none;
  color: var(--dim);
  cursor: pointer;
  font: 600 var(--fs-label) / 1.2 var(--f-head);
  text-align: center;
}
.ap-sw i {
  display: block;
  height: calc(58 * var(--u));
  background: var(--sw);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 calc(-12 * var(--u)) calc(14 * var(--u)) rgba(0, 0, 0, 0.3);
  transition: transform var(--t-fast) var(--ease);
}
.ap-sw[aria-pressed="true"] {
  color: var(--accent);
}
.ap-sw[aria-pressed="true"] i {
  box-shadow:
    inset 0 0 0 2px var(--accent),
    inset 0 0 0 4px rgba(11, 15, 16, 0.85);
}
.ap-sw.is-pressed i {
  transform: scale(0.94);
}
.ap-sw:focus-visible {
  outline: none;
}
.ap-sw:focus-visible i {
  box-shadow: inset 0 0 0 2px var(--info);
}
.ap-opts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: calc(8 * var(--u));
  padding: calc(4 * var(--u));
}
.gcard.ap-opt {
  display: flex;
  flex-direction: column;
  gap: calc(6 * var(--u));
  padding: calc(6 * var(--u)) calc(6 * var(--u)) calc(7 * var(--u));
  text-align: center;
  cursor: pointer;
  font: 600 var(--fs-label) / 1.2 var(--f-head);
  color: var(--dim);
}
.gcard.ap-opt[aria-pressed="true"] {
  color: var(--accent);
}
.ap-optart {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 3;
  overflow: hidden;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ap-optart > svg {
  display: block;
  width: 100%;
  height: 100%;
}
.ap-opt.is-emb .ap-optart {
  color: var(--text);
  background: radial-gradient(70% 80% at 50% 45%, var(--text-a08), transparent 70%), var(--panel);
}
.ap-opt.is-emb .ap-optart > svg {
  width: 58%;
  height: 58%;
}
.ap-opt.is-emb[aria-pressed="true"] .ap-optart {
  color: var(--accent);
}
.ap-lock {
  position: absolute;
  top: calc(3 * var(--u));
  right: calc(3 * var(--u));
  display: grid;
  place-items: center;
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
  background: rgba(4, 7, 8, 0.78);
  color: var(--dim);
}
.ap-lock .gglyph {
  width: 70%;
  height: 70%;
}
.ap-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: calc(4 * var(--u));
}
.ap-rules li {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  padding: calc(8 * var(--u)) calc(10 * var(--u));
  background: var(--text-a04);
}
.ap-rules li > .gglyph {
  flex: none;
  width: calc(20 * var(--u));
  height: calc(20 * var(--u));
  color: var(--info);
}
.ap-rules li.is-off > .gglyph {
  color: var(--faint);
}
.ap-rules li > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}
.ap-rules b {
  font: 600 var(--fs-sm) / 1.3 var(--f-head);
  color: var(--text);
}
.ap-rules small {
  font-size: var(--fs-label);
  line-height: 1.45;
  color: var(--dim);
}
.ap-mat {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  margin-top: calc(14 * var(--u));
  padding: calc(6 * var(--u)) calc(10 * var(--u)) calc(6 * var(--u)) calc(6 * var(--u));
  background: var(--panel-a72);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-sm);
  color: var(--dim);
}
.ap-mat .gcell {
  flex: none;
  width: calc(48 * var(--u));
  height: calc(48 * var(--u));
}
.ap-mat > span {
  flex: 1 1 auto;
}
.ap-mat > b {
  font-size: var(--fs-xl);
  color: var(--text);
}
.ap-act {
  flex: none;
  padding-top: calc(12 * var(--u));
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------------------------------------- tiers */
html[data-tier="phone"] .ap {
  gap: calc(10 * var(--u));
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
}
html[data-tier="phone"] .ap-cam {
  padding: calc(10 * var(--u)) calc(14 * var(--u)) 0;
}
html[data-tier="phone"] .ap-plate {
  margin: 0 0 calc(10 * var(--u)) calc(14 * var(--u));
}
html[data-tier="phone"] .ap-banner span {
  display: none;
}
html[data-tier="phone"] .ap-banner {
  margin-bottom: calc(8 * var(--u));
  padding-top: calc(6 * var(--u));
  padding-bottom: calc(6 * var(--u));
}
html[data-orient="portrait"] .ap {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(calc(170 * var(--u)), 0.8fr) minmax(0, 1.4fr);
}
html[data-orient="portrait"] .ap-plate {
  position: absolute;
  bottom: 0;
}
html[data-input="touch"] .ap-sw i {
  min-height: 44px;
}
