/* Personal Capital. One screen, one program, one owner.
   Every colour here was sampled off the two plates: the acid greens off the install
   banner, the bone and dust off the machine floating in space. */

@font-face {
  font-family: "Pixel Operator";
  src: url("/assets/fonts/PixelOperator.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Pixel Operator";
  src: url("/assets/fonts/PixelOperator-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #050b02;
  --deep: #073a04;
  --dark: #0a2f06;
  --mid: #30b214;
  --grass: #4fd518;
  --bright: #7aea1f;
  --acid: #96f824;
  --pale: #befb36;
  --cream: #ebfc6a;
  --bone: #f7fc97;

  --px: 3px; /* the one unit: border, gap and bar block all sit on it */
  --bar-h: 46px;
  --cursor: url("/assets/cursor.svg") 1 1, pointer;

  color-scheme: dark;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--ink);
  font-family: "Pixel Operator", "Courier New", monospace;
  font-size: 24px;
  line-height: 1.45;
  cursor: url("/assets/cursor.svg") 1 1, default;
  overflow-x: hidden;
}

/* ---------- the screen itself ---------- */

#field,
#wallcanvas,
#scene3d,
#wall,
#crt {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#field {
  z-index: 0;
  display: block;
}
#wallcanvas {
  z-index: 1;
  display: block;
}
#wallcanvas[hidden],
#scene3d[hidden] {
  display: none;
}
/* the machine turns between the sky and the windows */
#scene3d {
  z-index: 2;
  display: block;
}
#wall {
  z-index: 1;
  background: none;
}
body[data-wall="solid"] #wall {
  background: radial-gradient(120% 90% at 50% 8%, #0b3410, #05170a 70%, #041007 100%);
}
body[data-wall="grid"] #wall {
  background-color: #06280a;
  background-image:
    repeating-linear-gradient(to right, rgba(122, 234, 31, 0.16) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(to bottom, rgba(122, 234, 31, 0.16) 0 1px, transparent 1px 44px),
    radial-gradient(120% 80% at 50% 118%, rgba(150, 248, 36, 0.32), transparent 70%);
}

#crt {
  z-index: 60;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.19) 0 1px, rgba(0, 0, 0, 0) 1px 3px),
    radial-gradient(130% 110% at 50% 50%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
}
/* the roll bar: one soft band walking down the tube */
#crt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 22%;
  background: linear-gradient(rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
  mix-blend-mode: screen;
  animation: roll 7.5s linear infinite;
  opacity: 0.3;
}
@keyframes roll {
  from {
    transform: translateY(-30vh);
  }
  to {
    transform: translateY(105vh);
  }
}
body[data-motion="off"] #crt::after {
  display: none;
}

#screen {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
}

/* id selectors below would otherwise out-rank a plain [hidden] rule */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- boot and installer ---------- */

#boot {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 20px 40px;
  text-align: center;
}

.ident {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
.ident b {
  font-weight: 700;
}

#headline {
  margin: 0;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  max-width: 32ch;
  text-wrap: balance;
}

.bar {
  width: min(760px, 92vw);
  height: var(--bar-h);
  border: var(--px) solid var(--deep);
  padding: 5px;
  display: flex;
  gap: 5px;
  background: none;
}
.bar i {
  flex: 1 1 0;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(7, 58, 4, 0.28);
}
.bar i.on {
  background: var(--deep);
}

#statusline {
  margin: 0;
  min-height: 1.5em;
  color: var(--ink);
  max-width: 62ch;
}

/* the postponed screen: the tube goes dim, so the type stops being ink and becomes
   phosphor, the way it would on a machine that has nothing to show */
body[data-state="postponed"] .ident,
body[data-state="postponed"] #headline,
body[data-state="postponed"] #statusline {
  color: var(--acid);
}
body[data-state="postponed"] .bar {
  border-color: var(--acid);
}
body[data-state="postponed"] .bar i {
  box-shadow: inset 0 0 0 1px rgba(150, 248, 36, 0.3);
}
body[data-state="postponed"] .key {
  color: var(--acid);
  border-color: var(--acid);
}
body[data-state="postponed"] .key:hover,
body[data-state="postponed"] .key:focus-visible {
  background: var(--acid);
  color: var(--ink);
}

#choices {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 4px;
}

.key {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: none;
  border: var(--px) solid var(--ink);
  padding: 12px 20px;
  min-height: 46px;
  cursor: var(--cursor);
}
.key:hover,
.key:focus-visible {
  background: var(--ink);
  color: var(--bone);
}
.key:active {
  transform: translate(2px, 2px);
}
.key[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.key.small {
  padding: 9px 14px;
  min-height: 40px;
}

:focus-visible {
  outline: var(--px) solid currentColor;
  outline-offset: 3px;
}

/* ---------- desktop ---------- */

#desk {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-areas:
    "bar bar"
    "icons windows";
}
#menubar {
  grid-area: bar;
}
#icons {
  grid-area: icons;
}
#windows {
  grid-area: windows;
}

#menubar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--ink);
  border-bottom: var(--px) solid var(--acid);
  color: var(--acid);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mb-brand b {
  color: var(--bone);
}
.mb-owner {
  color: var(--pale);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mb-links {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex: none;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 4px 12px;
  border: var(--px) solid var(--acid);
  color: var(--acid);
  text-decoration: none;
  cursor: var(--cursor);
}
.mark:hover,
.mark:focus-visible {
  background: var(--acid);
  color: var(--ink);
}
.mark-label {
  letter-spacing: 0.1em;
}
/* pons ask for their name lowercase, and the menu bar upper cases everything else */
.mark-pons .mark-label {
  text-transform: lowercase;
  letter-spacing: 0.06em;
}
/* the pons mark is pale glass and wants a light plate under it, per their own guidance */
.mark-pons img {
  display: block;
  background: var(--bone);
  padding: 2px 4px;
  height: 34px;
  width: auto;
}
.mark[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

#icons {
  list-style: none;
  margin: 0;
  padding: 20px 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px 6px;
  width: 200px;
}
.icon {
  width: 176px;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 8px 4px;
  background: none;
  border: var(--px) solid transparent;
  font: inherit;
  color: var(--cream);
  cursor: var(--cursor);
}
.icon:hover,
.icon:focus-visible {
  border-color: var(--acid);
}
.ico {
  width: 40px;
  height: 40px;
  display: block;
  background: var(--pale) center / 30px 30px no-repeat;
  border: var(--px) solid var(--ink);
  image-rendering: pixelated;
}
/* the four glyphs, drawn on a 16 unit grid so they stay pixels at any size */
.ico-doc {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23050b02' d='M3 1h7l3 3v11H3z'/%3E%3Cpath fill='%23befb36' d='M10 1h1v3h3v1h-4zM5 6h6v1H5zM5 8h6v1H5zM5 10h6v1H5zM5 12h4v1H5z'/%3E%3C/svg%3E");
}
.ico-key {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23050b02' d='M2 4h7v7H2zM9 6h5v2H9zM12 8h2v3h-2z'/%3E%3Cpath fill='%23befb36' d='M4 6h3v3H4z'/%3E%3C/svg%3E");
}
.ico-crt {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23050b02' d='M1 2h14v10H1zM6 13h4v1H6zM4 14h8v1H4z'/%3E%3Cpath fill='%23befb36' d='M3 4h10v6H3z'/%3E%3C/svg%3E");
}
.ico-seal {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23050b02' d='M8 0l2 2h3v3l2 2-2 2v3h-3l-2 2-2-2H3v-3L1 9l2-2V4h3z'/%3E%3Cpath fill='%23befb36' d='M6 6h4v1H6zM6 8h4v1H6z'/%3E%3C/svg%3E");
}
.ico-name {
  font-size: 20px;
  line-height: 1.2;
  padding: 2px 6px;
  background: var(--ink);
  color: var(--cream);
  white-space: nowrap;
}

#windows {
  position: relative;
  min-height: 0;
}

.win {
  position: absolute;
  width: min(410px, calc(100vw - 32px));
  background: var(--dark);
  border: var(--px) solid var(--acid);
  box-shadow: 8px 8px 0 rgba(5, 11, 2, 0.55);
  color: var(--cream);
}
.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--acid);
  color: var(--ink);
  padding: 6px 6px 6px 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.win-bar:active {
  cursor: grabbing;
}
.win-title {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.win-close {
  flex: none;
  width: 30px;
  height: 30px;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  background: none;
  border: var(--px) solid var(--ink);
  color: var(--ink);
  cursor: var(--cursor);
}
.win-close:hover,
.win-close:focus-visible {
  background: var(--ink);
  color: var(--acid);
}
.win-body {
  padding: 14px 16px 18px;
  /* four windows open at once means two stacked per side, so a window gets a third of
     the desktop rather than two thirds of it */
  max-height: min(34dvh, 300px);
  overflow: auto;
}
.win-body > :first-child {
  margin-top: 0;
}
.win-body > :last-child {
  margin-bottom: 0;
}
.win-body p {
  margin: 0 0 12px;
}
.lede {
  font-weight: 700;
  color: var(--bone);
}
.dim {
  color: var(--bright);
}
.note {
  color: var(--pale);
}
.row-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bright);
}
.btnrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ca {
  color: var(--bone);
  background: var(--ink);
  border: var(--px) solid var(--bright);
  padding: 10px 12px;
  overflow-wrap: anywhere;
  user-select: all;
}
.ca[data-state="empty"] {
  color: var(--bright);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  user-select: auto;
}

.cfg {
  border: var(--px) solid var(--deep);
  margin: 0 0 14px;
  padding: 10px 12px 14px;
}
.cfg legend {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bright);
  padding: 0 6px;
}
.picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.picker label {
  cursor: var(--cursor);
}
.picker input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.swatch {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 4px;
  font-size: 18px;
  border: var(--px) solid transparent;
  color: var(--cream);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.picker input:checked + .swatch {
  border-color: var(--acid);
  background: rgba(150, 248, 36, 0.14);
}
.picker input:focus-visible + .swatch {
  outline: var(--px) solid var(--bone);
  outline-offset: 2px;
}
.swatch b {
  display: block;
  width: 56px;
  height: 34px;
  border: var(--px) solid var(--ink);
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}

#owner-input {
  font: inherit;
  min-height: 40px;
  flex: 1 1 150px;
  min-width: 0;
  padding: 8px 10px;
  background: var(--ink);
  border: var(--px) solid var(--bright);
  color: var(--bone);
  text-transform: uppercase;
}
#owner-input::placeholder {
  color: var(--mid);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: var(--cursor);
}
.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--acid);
  cursor: var(--cursor);
}

#cert-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 165px;
  border: var(--px) solid var(--bright);
  margin-bottom: 12px;
}

.noscript {
  position: relative;
  z-index: 20;
  margin: 18vh auto;
  max-width: 40ch;
  padding: 18px;
  background: var(--ink);
  color: var(--cream);
  border: var(--px) solid var(--acid);
}

/* ---------- bigger screens ---------- */

@media (min-width: 720px) {
  #headline {
    font-size: 48px;
  }
}
@media (min-width: 1100px) {
  :root {
    --bar-h: 56px;
  }
  #headline {
    font-size: 64px;
  }
}

/* ---------- phone: the windows stop floating and stack ---------- */

@media (max-width: 719px) {
  body {
    font-size: 20px;
  }
  .ident {
    font-size: 18px;
  }
  /* the two marks keep their official artwork and drop the words: at 390 the menu bar
     was spending three rows on chrome */
  .mark-label {
    display: none;
  }
  .ico-name {
    font-size: 18px;
  }
  #desk {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "bar"
      "icons"
      "windows";
    padding-bottom: env(safe-area-inset-bottom);
  }
  #menubar {
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .mb-owner {
    order: 3;
    width: 100%;
  }
  #icons {
    width: 100%;
    padding: 14px 12px;
    justify-content: flex-start;
  }
  .icon {
    width: calc(50% - 3px);
  }
  #windows {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 12px 24px;
  }
  .win {
    position: static;
    width: auto;
    box-shadow: 5px 5px 0 rgba(5, 11, 2, 0.55);
  }
  .win-bar {
    cursor: default;
  }
  .win-body {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #crt::after {
    display: none;
  }
  .key:active {
    transform: none;
  }
}
