/* colemitchell.io: a 1-bit desktop in the spirit of the original Macintosh Finder */

:root {
  --ink: #000;
  --paper: #fff;
  --disabled: #8a8a8a;
  --bar: 26px;
  --chrome: "Pixelify Sans", Geneva, "Helvetica Neue", sans-serif;
  --text: "Newsreader", "New York", Georgia, serif;
  /* 50% gray, the way a 1-bit screen draws it: alternating black and white pixels */
  --gray50: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Crect width='2' height='2' fill='%23fff'/%3E%3Crect width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3C/svg%3E");
  --grow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' shape-rendering='crispEdges'%3E%3Cpath d='M5.5 5.5h7v7h-7z' fill='%23fff' stroke='%23000'/%3E%3Cpath d='M2.5 2.5h5v5h-5z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E");
  --arrow-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' shape-rendering='crispEdges'%3E%3Cpath d='M7.5 2.5l5 5h-3v4h-4v-4h-3z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E");
  --arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' shape-rendering='crispEdges'%3E%3Cpath d='M7.5 12.5l5-5h-3v-4h-4v4h-3z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E");
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: var(--bar);
  font: 400 18px/1.55 var(--text);
  color: var(--ink);
  background: var(--paper) var(--gray50) 0 0 / 2px 2px repeat;
  image-rendering: pixelated;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
}

img[data-dither]:not(.is-dithered) {
  filter: grayscale(1) contrast(1.15);
}

img.is-dithered {
  image-rendering: pixelated;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

:focus-visible {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

/* ---------- Menu bar ---------- */

.menubar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: var(--bar);
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  font: 400 16px/1 var(--chrome);
  user-select: none;
}

.menus {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu {
  position: relative;
}

.menu-title {
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: default;
}

/* 25x33 pixel grid at half size: one grid pixel per device pixel on 2x screens */
.menu-title svg {
  display: block;
  width: 12.5px;
  height: 16.5px;
}

.menu-title[aria-expanded="true"] {
  background: var(--ink);
  color: var(--paper);
}

.menu-title[aria-expanded="true"] svg {
  filter: invert(1);
}

.menu-list {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 190px;
  margin: 0;
  padding: 3px 0;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 1px 1px 0 var(--ink);
}

.menu-list a,
.menu-list button {
  display: block;
  width: 100%;
  padding: 4px 18px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1.1;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: default;
}

.menu-list a:hover,
.menu-list button:enabled:hover,
.menu-list a:focus-visible,
.menu-list button:focus-visible {
  outline: none;
  background: var(--ink);
  color: var(--paper);
}

.menu-list button:disabled {
  color: var(--disabled);
}

.menu-sep {
  margin: 3px 0;
  border-top: 1px dotted var(--ink);
}

.clock {
  align-self: center;
  padding: 0 8px;
}

/* ---------- Screen corners ---------- */

.corners span {
  position: fixed;
  z-index: 2000;
  width: 8px;
  height: 8px;
  pointer-events: none;
}

.corners .tl { top: 0; left: 0; background: radial-gradient(circle at 100% 100%, transparent 7px, var(--ink) 7.5px); }
.corners .tr { top: 0; right: 0; background: radial-gradient(circle at 0 100%, transparent 7px, var(--ink) 7.5px); }
.corners .bl { bottom: 0; left: 0; background: radial-gradient(circle at 100% 0, transparent 7px, var(--ink) 7.5px); }
.corners .br { bottom: 0; right: 0; background: radial-gradient(circle at 0 0, transparent 7px, var(--ink) 7.5px); }

/* ---------- Desktop (stacked layout: phones, tablets, no JS) ---------- */

.desktop {
  position: relative;
  padding: 20px 12px 56px;
}

.desktop-only {
  display: none;
}

.icons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 8px;
  max-width: 780px;
  margin: 0 auto 28px;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .icons {
    grid-template-columns: repeat(6, 1fr);
  }
}

.icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 88px;
  margin: 0 auto;
  color: var(--ink);
  text-decoration: none;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.icon svg {
  width: 32px;
  height: 32px;
}

.icon span {
  padding: 1px 4px;
  background: var(--paper);
  font: 400 14px/1.15 var(--chrome);
  text-align: center;
}

.icon:focus-visible {
  outline: none;
}

.icon:focus-visible span {
  outline: 1px dotted var(--ink);
  outline-offset: 2px;
}

.icon.is-selected svg {
  filter: invert(1);
}

.icon.is-selected span {
  background: var(--ink);
  color: var(--paper);
}

.windows {
  display: grid;
  gap: 28px;
  max-width: 780px;
  margin: 0 auto;
}

/* ---------- Windows ---------- */

.window {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 1px 1px 0 var(--ink);
}

.window:focus {
  outline: none;
}

.titlebar {
  position: relative;
  flex: none;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 22px;
  border-bottom: 1px solid var(--ink);
  user-select: none;
  touch-action: none;
  cursor: default;
}

.titlebar::before {
  content: "";
  position: absolute;
  inset: 4px 2px;
  background: repeating-linear-gradient(var(--ink) 0 1px, transparent 1px 2px);
}

.window .title {
  position: relative;
  max-width: calc(100% - 80px);
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  background: var(--paper);
  font: 400 16px/21px var(--chrome);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.box {
  position: absolute;
  top: 4px;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--paper);
  cursor: default;
}

.box:active {
  background: var(--ink);
}

.box.close {
  left: 8px;
}

.box.zoom {
  right: 8px;
}

.box.zoom::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

:root:not(.is-desktop) .box.zoom {
  display: none;
}

.finder-info {
  flex: none;
  display: flex;
  justify-content: space-between;
  padding: 3px 12px 2px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 2px 0 var(--paper), 0 3px 0 var(--ink);
  font: 400 14px/1.2 var(--chrome);
}

.window-body {
  padding: 24px 28px 28px;
}

.window-body.is-flush {
  padding: 0;
}

.window-foot {
  display: none;
}

.window.is-shaded .finder-info,
.window.is-shaded .window-body,
.window.is-shaded .window-foot {
  display: none;
}

.window.is-shaded .titlebar {
  border-bottom: 0;
}

/* ---------- Document typography ---------- */

.window-body > :last-child,
.window-body article > :last-child {
  margin-bottom: 0;
}

.window-body p,
.window-body ul {
  max-width: 62ch;
  margin: 0 0 0.9em;
}

.window-body ul {
  padding-left: 1.15em;
}

.window-body li + li {
  margin-top: 0.35em;
}

.window-body strong {
  font-weight: 600;
}

.window-body a:not(.btn) {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.window-body a:not(.btn):hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.window-body h1 {
  margin: 0 0 10px;
  font: 400 48px/0.95 var(--chrome);
}

.window-body h3 {
  margin: 0;
  font: 500 21px/1.25 var(--chrome);
}

.about-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 22px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--ink);
}

.portrait {
  width: 132px;
  border: 1px solid var(--ink);
}

.window-body .email {
  margin: 0;
  font-size: 16px;
}

.emoji {
  filter: grayscale(1);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.btn {
  display: inline-block;
  min-width: 76px;
  padding: 6px 16px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1 var(--chrome);
  text-align: center;
  text-decoration: none;
  cursor: default;
}

.btn:active {
  background: var(--ink);
  color: var(--paper);
}

.btn-default {
  margin: 4px 6px 4px 4px;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 5px var(--ink);
}

.btn-icon {
  min-width: 0;
  padding: 6px 16px;
}

.btn-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

.btn-icon:active svg {
  filter: invert(1);
}

.role + .role,
.school + .school {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px dotted var(--ink);
}

.role-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  column-gap: 20px;
}

.window-body .dates {
  margin: 0;
  font: 400 15px/1.4 var(--chrome);
  white-space: nowrap;
}

.window-body .org {
  margin: 4px 0 12px;
  font-style: italic;
}

.school {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 22px;
}

.logo {
  width: 72px;
  margin-top: 4px;
}

.photo {
  margin: 22px 0 0;
}

.photo img {
  width: 100%;
  border: 1px solid var(--ink);
}

.photo figcaption {
  margin-top: 8px;
  font-style: italic;
  font-size: 16px;
}

/* Finder list view */

.listview {
  width: 100%;
  border-collapse: collapse;
  font: 400 15px/1 var(--chrome);
}

.listview th {
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--ink);
  font-weight: 400;
  text-align: left;
}

.listview td {
  padding: 3px 12px;
  white-space: nowrap;
}

.listview td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.listview tbody tr:first-child td {
  padding-top: 7px;
}

.listview svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.listview tr.is-selected td {
  background: var(--ink);
  color: var(--paper);
}

.listview tr.is-selected svg {
  filter: invert(1);
}

/* Resume */

.resume-body iframe {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
}

.window-body .resume-actions {
  max-width: none;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--ink);
  text-align: right;
}

/* ---------- Desktop mode (wide screens, JS on) ---------- */

.is-desktop body {
  height: 100vh;
  overflow: hidden;
}

.is-desktop .desktop {
  position: fixed;
  inset: var(--bar) 0 0;
  padding: 0;
  overflow: hidden;
}

.is-desktop:not(.is-ready) .window {
  visibility: hidden;
}

.is-desktop .desktop-only {
  display: block;
}

.is-desktop .icons {
  position: absolute;
  top: 18px;
  right: 12px;
  bottom: 18px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
}

.is-desktop .icons li:last-child {
  margin-top: auto;
}

.is-desktop .windows {
  display: block;
  max-width: none;
  margin: 0;
}

.is-desktop .window {
  position: absolute;
}

.is-desktop .window.is-shaded {
  height: auto !important;
}

.is-desktop .window:not(.is-active) .titlebar::before,
.is-desktop .window:not(.is-active) .box {
  visibility: hidden;
}

.is-desktop .window-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.is-desktop .resume-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.is-desktop .resume-body iframe {
  flex: 1 1 auto;
  height: auto;
}

.is-desktop .window-foot {
  position: relative;
  flex: none;
  display: block;
  height: 16px;
  border-top: 1px solid var(--ink);
}

.grow {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 15px;
  border-left: 1px solid var(--ink);
  background: var(--paper) var(--grow) center / 15px 15px no-repeat;
  cursor: nwse-resize;
  touch-action: none;
}

.is-desktop .is-dragging iframe {
  pointer-events: none;
}

/* Classic scroll bars */

.is-desktop .window-body::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.is-desktop .window-body::-webkit-scrollbar-track {
  background: var(--paper) var(--gray50) 0 0 / 2px 2px;
  border-left: 1px solid var(--ink);
}

.is-desktop .window-body::-webkit-scrollbar-thumb {
  min-height: 24px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-right: 0;
}

.is-desktop .window-body::-webkit-scrollbar-button:vertical:start:decrement,
.is-desktop .window-body::-webkit-scrollbar-button:vertical:end:increment {
  display: block;
  height: 16px;
  border-left: 1px solid var(--ink);
  background: var(--paper) center / 15px 15px no-repeat;
}

.is-desktop .window-body::-webkit-scrollbar-button:vertical:start:decrement {
  border-bottom: 1px solid var(--ink);
  background-image: var(--arrow-up);
}

.is-desktop .window-body::-webkit-scrollbar-button:vertical:end:increment {
  border-top: 1px solid var(--ink);
  background-image: var(--arrow-down);
}

.is-desktop .window-body::-webkit-scrollbar-button:vertical:start:increment,
.is-desktop .window-body::-webkit-scrollbar-button:vertical:end:decrement {
  display: none;
}

@supports not selector(::-webkit-scrollbar) {
  .is-desktop .window-body {
    scrollbar-color: var(--ink) var(--paper);
  }
}

/* Drag outlines and the zoom-open animation */

.zoom-layer {
  position: absolute;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
}

.ghost,
.zoom-rect {
  position: absolute;
  border: 1px dotted var(--ink);
  pointer-events: none;
}

/* ---------- Alert dialog ---------- */

.alert {
  max-width: min(440px, calc(100vw - 32px));
  padding: 1px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.alert::backdrop {
  background: transparent;
}

.alert-inner {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 16px 18px;
  padding: 18px 20px 16px;
  border: 3px solid var(--ink);
}

.alert-icon {
  width: 25px;
  height: 33px;
}

.alert-text p {
  margin: 0 0 8px;
  font-size: 17px;
  line-height: 1.45;
}

.alert-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.is-restarting body > * {
  visibility: hidden;
}

.is-restarting body {
  background: var(--ink);
}

/* ---------- Phones ---------- */

@media (max-width: 480px) {
  .window-body:not(.is-flush) {
    padding: 20px 18px 24px;
  }

  .window-body h1 {
    font-size: 40px;
  }

  .buttons {
    gap: 10px;
  }

  .btn {
    padding: 6px 12px;
  }
}
