/* The monitor: bezel, top bar, screen (sidebar + content), nav buttons, footer. */

.computer {
  width: min(var(--monitor-width), 100%);
  height: 100%;
  margin: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.machine {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--plum);
  border: 18px solid var(--bezel);
  outline: var(--pixel) solid var(--shadow);
  box-shadow:
    12px 12px 0 var(--shadow),
    -5px -5px 0 #b7a3c6,
    0 0 90px 10px rgba(255, 190, 130, 0.28);
}

/* power LED on the bezel */
.machine::before {
  content: "";
  position: absolute;
  z-index: 4;
  bottom: -9px;
  left: 50%;
  width: 22px;
  height: 10px;
  background: #7be08f;
  transform: translateX(-50%);
}

.pc-neck {
  flex: none;
  width: 90px;
  height: 36px;
  margin: auto;
  background: var(--bezel);
  border: var(--pixel) solid var(--shadow);
  border-top: 0;
}

.pc-base {
  flex: none;
  width: 250px;
  height: 19px;
  margin: auto;
  background: var(--bezel);
  border: var(--pixel) solid var(--shadow);
  box-shadow: 8px 6px 0 rgba(27, 15, 34, 0.55);
}

/* ---------- plug: power strip on the desk, left of the stand ---------- */

/* A <button>; clicking it toggles <html class="unplugged"> (js/app.js). */
.plug {
  position: absolute;
  bottom: 0;
  right: calc(50% + 125px); /* cable ends at the left edge of .pc-base */
  width: 160px; /* 40 svg units x 4px */
  padding: 0;
  border: 0;
  box-shadow: none;
  line-height: 0;
  transition: none;
}

.plug,
.plug:hover {
  background: none;
}

.plug:active {
  transform: none;
}

.plug svg {
  display: block;
  width: 100%;
  overflow: visible;
  shape-rendering: crispEdges;
}

.plug__light {
  fill: var(--red);
}

.plug__spark {
  opacity: 0;
}

/* hint that the plug can be pulled: it wiggles and sparks */
.plug:hover .plug__head,
.plug:focus-visible .plug__head {
  animation: plug-wiggle 0.36s steps(2) infinite;
}

.plug:hover .plug__spark,
.plug:focus-visible .plug__spark {
  animation: plug-spark 0.36s steps(2) infinite;
}

@keyframes plug-wiggle {
  50% {
    translate: 1px 0;
  }
}

@keyframes plug-spark {
  50% {
    opacity: 1;
  }
}

/* ---------- unplugged: plug on the desk, screen dark ---------- */

html.unplugged .plug__head {
  transform: translate(5px, 1px);
}

html.unplugged .plug__light {
  fill: var(--muted);
}

html.unplugged .plug__spark {
  display: none;
}

html.unplugged .machine {
  box-shadow:
    12px 12px 0 var(--shadow),
    -5px -5px 0 #b7a3c6;
}

html.unplugged .machine::before {
  background: #3a2a3f;
}

.power-off {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 20px;
  background: #0d0712;
  color: #fdebd0;
  text-align: center;
  font-family: var(--font-pixel);
}

html.unplugged .power-off {
  display: flex;
}

/* old-monitor effect: the picture collapses into a line */
.power-off::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #fff;
  animation: crt-line 0.45s steps(6) forwards;
}

@keyframes crt-line {
  to {
    scale: 0 1;
    opacity: 0;
  }
}

.power-off p {
  margin: 0;
  animation: power-off-text 0.1s 0.55s backwards;
}

@keyframes power-off-text {
  from {
    opacity: 0;
  }
}

.power-off__ouch {
  font-size: clamp(26px, 6vw, 54px);
  color: var(--red);
}

.power-off__hint {
  font-size: clamp(10px, 2vw, 16px);
}

.power-off .power-off__hint {
  animation:
    power-off-text 0.1s 0.55s backwards,
    power-off-blink 1.2s 0.65s steps(2) infinite;
}

@keyframes power-off-blink {
  50% {
    opacity: 0.2;
  }
}

/* ---------- top bar and footer ---------- */

.top {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 34px 15px;
  border-bottom: var(--pixel) solid var(--shadow);
  background: var(--plum);
  color: #fdebd0;
}

.footer {
  flex: none;
  display: flex;
  justify-content: space-between;
  padding: 13px 25px;
  border-top: var(--pixel) solid var(--shadow);
  background: var(--plum);
  color: #fdebd0;
}

/* Text link to cv.html; only shown when the wall switch is hidden. */
.cv-link {
  display: none;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cv-link:hover {
  background: none;
  color: var(--orange);
}

.cv-link:active {
  transform: none;
}

/* ---------- screen ---------- */

.screen-shell {
  flex: 1;
  min-height: 0;
  padding: 22px;
  background: var(--shadow);
}

.screen {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(190px, 24%, 270px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  border: var(--pixel) solid var(--ink);
  outline: var(--pixel) solid var(--peach);
  background: var(--cream);
}

/* ---------- sidebar: portrait, name, status ---------- */

.identity {
  min-height: 0;
  overflow-y: auto;
  padding: 25px 21px;
  background: var(--orange);
  border-right: var(--pixel) solid var(--ink);
}

.identity p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
}

.pixel-portrait {
  position: relative;
  width: min(140px, 100%, 22dvh);
  min-width: 72px;
  aspect-ratio: 1;
  margin: 0 auto 25px;
  background: var(--teal);
  border: var(--pixel) solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.pixel-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* green "available" dot */
.led {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  background: #5dd17a;
  box-shadow: 2px 2px 0 var(--ink);
}

/* ---------- content area ---------- */

.console {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 31px;
}

/* One .module per nav button; only the active one is shown. */
.module {
  display: none;
}

.module.active {
  display: block;
}

.module h2 {
  font: 15px/1.5 var(--font-pixel);
  margin: 0 0 19px;
}

.boot {
  font: 10px var(--font-pixel);
  color: #6b5571;
  margin: 0 0 23px;
}

.readout {
  max-width: 640px;
  margin: 0 0 25px;
  font-size: 19px;
  line-height: 1.5;
}

.readout strong {
  background: var(--red);
  color: #fff;
  padding: 0 5px;
}

/* three fact cards on the About page */
.factgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.fact {
  padding: 12px;
  font-size: 15px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(43, 26, 51, 0.18);
}

.fact b {
  display: block;
  margin-bottom: 8px;
  font: 10px/1.5 var(--font-pixel);
  color: var(--red);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 0;
}

.cta button {
  padding: 14px 16px;
}

.cta button:first-child {
  background: var(--red);
  color: #fff;
}

/* small red section label inside a module */
.label {
  margin: 22px 0 10px;
  font: 10px/1.5 var(--font-pixel);
  color: var(--red);
}

.module h2 + .label {
  margin-top: 0;
}

/* employer heading above a set of entries */
.group {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 3px solid var(--ink);
}

/* a second group in the same section starts after a clear gap */
.note + .group,
.entry + .group {
  margin-top: 24px;
}

.group h3 {
  margin: 0;
  font-size: 16px;
}

.group time {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* dated row: job, degree or certificate */
.entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  padding: 13px 0;
  border-top: 2px dashed #8b7390;
}

.entry time {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.entry h3 {
  margin: 0 0 3px;
  font-size: 16px;
}

.entry p {
  margin: 0;
  font-size: 15px;
}

.entry .sub {
  font-size: 14px;
  color: var(--muted);
}

.entry ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 15px;
}

.entry li {
  margin-bottom: 4px;
}

.org {
  font-weight: 400;
  color: var(--muted);
}

.note {
  margin: 0;
  padding-top: 10px;
  font-size: 13px;
  color: var(--muted);
  border-top: 2px dashed #8b7390;
}

/* A project is a <details>; its <summary> is the clickable title bar. */
.project {
  margin: 10px 0;
  font-size: 15px;
  background: var(--paper);
  border: 3px solid var(--ink);
}

.project summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  font-weight: 500;
  color: var(--red);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.project summary::-webkit-details-marker {
  display: none;
}

.project summary::after {
  content: "[+]";
  flex: none;
  font: 10px/1 var(--font-pixel);
  color: var(--ink);
}

.project[open] summary::after {
  content: "[-]";
}

.project summary:hover {
  background: var(--cream);
}

.project summary:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: -3px;
}

.project[open] summary {
  border-bottom: 2px dashed #8b7390;
}

.project > :not(summary) {
  margin-left: 12px;
  margin-right: 12px;
}

.project > ul {
  padding-left: 18px;
}

.project b {
  color: var(--red);
}

.skillset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill {
  padding: 7px 10px;
  font-size: 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
}

.contact-link {
  font-size: 16px;
  font-weight: bold;
  color: var(--ink);
  word-break: break-word;
}

/* ---------- nav buttons under the screen ---------- */

.controls {
  flex: none;
  padding: 20px 25px 24px;
  background: var(--peach);
}

.buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.buttons button {
  min-width: 0;
  overflow-wrap: anywhere;
}
