:root {
  --desktop-bg-1: #e9e9e9;
  --desktop-bg-2: #f6f6f6;
  --ui: #e5e5e5;
  --ui-dark: #9a9a9a;
  --ui-darker: #565656;
  --ui-light: #ffffff;
  --ink: #111;
  --stripe: #cfcfcf;
  --shadow: rgba(0, 0, 0, 0.25);
  font-family: Chicago, Geneva, "MS Sans Serif", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #bdbdbd;
  color: var(--ink);
}

.desktop {
  height: 100%;
  display: grid;
  grid-template-rows: 26px 1fr 40px;
}

.menubar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: var(--ui);
  color: var(--ink);
  border-bottom: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark);
  font-size: 12px;
  user-select: none;
}

.menubar__left {
  display: flex;
  gap: 6px;
  align-items: center;
}

.menubar__favicon {
  width: 16px;
  height: 16px;
  border: 1px solid var(--ink);
}

.menubar__btn {
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.menubar__btn:focus-visible {
  outline: 1px dotted var(--ink);
}

.menubar__btn[aria-expanded="true"],
.menubar__btn:active {
  border-color: var(--ui-darker);
  box-shadow:
    inset -1px -1px 0 var(--ui-light),
    inset 1px 1px 0 var(--ui-dark);
  background: white;
}

.menubar__btn#menu-home {
  padding: 3px 6px;
}

.menubar__btn#menu-home:active {
  padding: 4px 5px 2px 7px;
}

.menu {
  position: absolute;
  top: 26px;
  left: 6px;
  min-width: 190px;
  background: white;
  border: 1px solid var(--ui-darker);
  box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.12);
  padding: 4px;
  z-index: 9999;
}

.menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  font-size: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--stripe);
  outline: none;
}

.menu__sep {
  height: 1px;
  margin: 4px;
  background: var(--ui-dark);
}

.desktop__area {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      45deg,
      var(--desktop-bg-1) 0,
      var(--desktop-bg-1) 6px,
      var(--desktop-bg-2) 6px,
      var(--desktop-bg-2) 12px
    );
}

.desktop__icons {
  position: absolute;
  inset: 0;
  padding: 12px;
}

.desktop-icon {
  position: absolute;
  width: 90px;
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  cursor: default;
  user-select: none;
}

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

.desktop-icon__glyph {
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 6px;
  background: white;
  border: 1px solid var(--ui-darker);
  box-shadow: 2px 2px 0 var(--ui-darker);
  position: relative;
  overflow: hidden;
}

.desktop-icon__glyph svg {
  width: 36px;
  height: 36px;
}

/* Home icon - house with door */
.desktop-icon[data-page="home"] .desktop-icon__glyph svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Projects icon - folder */
.desktop-icon[data-page="projects"] .desktop-icon__glyph svg path {
  fill: white;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Resources icon - book */
.desktop-icon[data-page="resources"] .desktop-icon__glyph svg path {
  fill: white;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Tools icon - wrench */
.desktop-icon[data-page="tools"] .desktop-icon__glyph svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Games icon - controller */
.desktop-icon[data-page="games"] .desktop-icon__glyph svg path {
  fill: white;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Contact icon - envelope */
.desktop-icon[data-page="contact"] .desktop-icon__glyph svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.desktop-icon__label {
  display: block;
}

.desktop__windows {
  position: absolute;
  inset: 0;

  /* Let desktop icons receive clicks when no windows there. */
  pointer-events: none;
}

.window {
  pointer-events: auto;
}

.window {
  position: absolute;
  min-width: 260px;
  min-height: 180px;
  max-width: min(920px, calc(100vw - 20px));
  max-height: calc(100% - 20px);
  background: var(--ui);
  border: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark),
    10px 14px 0 rgba(0, 0, 0, 0.08);
}

.window__titlebar {
  height: 24px;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  padding: 2px 4px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--stripe) 0,
      var(--stripe) 2px,
      #f4f4f4 2px,
      #f4f4f4 4px
    );
  color: var(--ink);
  user-select: none;
  cursor: move;
}

.window.is-inactive {
  opacity: 1;
}

.window__icon {
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.window__icon svg {
  width: 12px;
  height: 12px;
}

.window__icon svg path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.window__title {
  font-size: 12px;
  font-weight: 700;
  padding-left: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window__controls {
  display: flex;
  gap: 3px;
}

.window__btn {
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  color: var(--ink);
  background: var(--ui);
  border: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark);
}

.window__btn:active {
  box-shadow:
    inset -1px -1px 0 var(--ui-light),
    inset 1px 1px 0 var(--ui-dark);
}

.window.is-minimized {
  min-height: 0;
}

.window.is-minimized .window__body {
  display: none;
}

.window.is-minimized .window__resize {
  display: none;
}

.window__body {
  background: var(--ui);
  border-top: 1px solid var(--ui-darker);
  height: calc(100% - 24px);
  overflow: auto;
}

.window__body-inner {
  padding: 14px;
  background: white;
  border: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark);
  margin: 8px;
  min-height: calc(100% - 16px);
  font-size: 13px;
  line-height: 1.45;
}

/* Typography inside content windows */
.window__body-inner h2 {
  margin: 0 0 10px;
  font-size: 16px;
  border-bottom: 1px solid var(--stripe);
  padding-bottom: 6px;
}

.window__body-inner h3 {
  margin: 0;
  font-size: 13px;
}

.window__body-inner p {
  margin: 0;
}

.window__body-inner p + p {
  margin-top: 10px;
}

.window__body-inner ul,
.window__body-inner ol {
  margin: 8px 0;
  padding-left: 20px;
}

.window__body-inner li + li {
  margin-top: 6px;
}

.window__body-inner a {
  color: #0000aa;
}

.window__body-inner code {
  padding: 0 3px;
  border: 1px solid var(--stripe);
  background: #f2f2f2;
}

/* Optional tighter list used in resources/projects */
.window__body-inner .link-list {
  padding-left: 18px;
}

/* Books page layout */
.window__body-inner .book-list {
  list-style: none;
  padding-left: 0;
}

.window__body-inner .book-list > li {
  padding: 10px 10px;
  border: 1px solid var(--stripe);
  background: #fbfbfb;
}

.window__body-inner .book-list > li + li {
  margin-top: 10px;
}

.window__body-inner .book-list > li p {
  margin-top: 6px;
}

.window__body-inner .book-meta {
  font-weight: 400;
  color: #444;
  margin-left: 6px;
}

.window__resize {
  position: absolute;
  width: 14px;
  height: 14px;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, var(--ui-dark) 50%),
    linear-gradient(135deg, transparent 65%, var(--ui-light) 65%);
}

.taskbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: var(--ui);
  border-top: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark);
}

.taskbar__left {
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--ui-darker);
  box-shadow:
    inset 1px 1px 0 var(--ui-light),
    inset -1px -1px 0 var(--ui-dark);
  background: white;
}

.taskbar__spacer {
  flex: 1;
}

.taskbar__clock {
  height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--ui-darker);
  box-shadow:
    inset -1px -1px 0 var(--ui-light),
    inset 1px 1px 0 var(--ui-dark);
  background: white;
}

.about__photo {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 10px;
}

.link-list {
  padding-left: 18px;
}

@media (max-width: 720px) {
  .desktop {
    grid-template-rows: 26px 1fr 40px;
  }

  .window {
    left: 10px !important;
    top: 10px !important;
    width: calc(100vw - 20px) !important;
    height: calc(100% - 76px) !important;
  }

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

  .desktop-icon {
    position: static;
    display: inline-block;
    margin: 8px;
  }

  .desktop__icons {
    padding: 10px;
  }
}
