:root {
  --text-body: 16px;
  --text-small: 14px;
  --text-heading: 20px;
  --text-ui: 14px;
}

@font-face {
  font-family: "VT323";
  src: url("assets/fonts/VT323-Regular.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #316e70;
  color: #172e2d;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: var(--text-body);
  line-height: 1.6;
}

h1,
h2,
h3,
p,
figure,
blockquote {
  margin: 0;
  font-weight: normal;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a,
p,
h2,
h3 {
  overflow-wrap: anywhere;
}

:focus-visible,
[data-window]:focus {
  outline: 3px solid #a33912;
  outline-offset: 3px;
}

button {
  cursor: pointer;
}

nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #222;
  background: silver;
  box-shadow:
    inset -1px -1px #0a0a0a,
    inset 1px 1px #fff,
    inset -2px -2px grey,
    inset 2px 2px #dfdfdf;
  font:
    var(--text-ui) "Pixelated MS Sans Serif",
    Arial,
    sans-serif;
  padding: 8px 14px;
  min-height: 34px;
}

nav a:active {
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px #0a0a0a,
    inset -2px -2px #dfdfdf,
    inset 2px 2px grey;
}

#restore,
#restart,
#skip-boot {
  min-height: 36px;
  font:
    var(--text-body) / 1.3 Tahoma,
    Arial,
    sans-serif;
  padding: 6px 16px;
}

.skip {
  position: absolute;
  top: -100px;
  left: 12px;
  padding: 12px;
  background: white;
  z-index: 5;
}

.skip:focus {
  top: 12px;
}

.site-shell {
  max-width: 1240px;
  margin: auto;
  padding: 24px 40px;
}

header h1 {
  font-family: "VT323", monospace;
  min-height: 1em;
  font-size: 88px;
  line-height: 1;
  color: #f2f4df;
  margin: 8px 0 20px;
}

header h1 .cursor {
  color: #edeea0;
}

nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 26px;
}

nav a {
  text-decoration: none;
}

.windows {
  display: grid;
  grid-auto-flow: row dense;
  grid-template-columns: minmax(0, 2.3fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.window {
  min-width: 0;
  border: 0;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: var(--text-body);
  line-height: 1.6;
  scroll-margin-top: 16px;
}

.title-bar {
  gap: 12px;
  min-height: 30px;
}

.title-bar .title-bar-text {
  font:
    bold var(--text-ui) / 1.4 "Pixelated MS Sans Serif",
    Arial,
    sans-serif;
  margin: 0;
  min-width: 0;
}

.title-bar-controls {
  flex-shrink: 0;
}

.title-bar .title-bar-controls button[aria-label].close {
  min-width: 24px;
  min-height: 24px;
  background-position: center;
  background-size: 12px 11px;
  image-rendering: pixelated;
}

.title-bar-controls button:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

.window-body {
  margin: 8px;
  padding: 16px;
}

.window-body > h3 {
  font-size: var(--text-heading);
  font-weight: bold;
}

.window-body p + p {
  margin-top: 18px;
}

.portrait {
  grid-column: 2;
  grid-row: span 2;
}

.portrait img {
  display: block;
  width: calc(100% - 24px);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  margin: 16px auto;
}

figcaption {
  font-size: var(--text-small);
  padding: 0 16px 18px;
}

.quote .window-body {
  background: #e5e9b0;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 18px 24px;
}

blockquote {
  font-size: 40px;
}

.research,
.blog {
  grid-column: 1;
}

.socials,
.contact {
  grid-column: 2;
}

.inset {
  margin: 8px;
}

.publication-scroll {
  height: 540px;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: #fff;
}

.publications {
  margin: 0;
  padding: 0;
  list-style: none;
}

.publications li {
  padding: 20px 22px;
  border-bottom: 1px solid #b0b2a6;
}

.publications .featured {
  background: #f0efd2;
}

.publication-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: var(--text-small);
  margin-bottom: 9px;
}

.featured-badge {
  color: #4d3902;
  background: #e9d77b;
  border: 1px solid #7a6c30;
  padding: 1px 8px;
}

.featured-badge span {
  font-family: monospace;
  font-size: var(--text-body);
}

.publications h3 {
  font-size: var(--text-heading);
  line-height: 1.4;
  margin-bottom: 10px;
}

.publications p {
  font-size: var(--text-small);
  margin-top: 5px;
}

.status-bar {
  margin: 6px 1px 1px;
}

.status-bar-field {
  padding: 5px 8px;
  font:
    var(--text-small) / 1.5 "Pixelated MS Sans Serif",
    Arial,
    sans-serif;
}

.bookmarks {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.bookmarks li + li {
  border-top: 1px solid #b0b2a6;
}

.bookmarks a {
  display: block;
  padding: 9px 0;
}

.blog-scroll {
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
}

.blog-entry {
  padding: 22px;
}

.blog-entry h3 {
  font-size: var(--text-heading);
  margin: 10px 0;
}

.draft {
  display: inline-block;
  font-size: var(--text-small);
  background: #e5e9b0;
  color: #333e14;
  padding: 2px 6px;
}

.contact p {
  font-size: var(--text-body);
}

footer {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: #f2f4df;
  font-size: var(--text-small);
  align-items: center;
  padding: 28px 0 10px;
}

footer > span {
  margin-right: auto;
}

dialog {
  color: inherit;
  padding: 3px;
}

dialog::backdrop {
  background: #102c36b8;
}

#post-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: 85dvh;
  overflow-y: auto;
}

#post-content p {
  margin-top: 22px;
}

#crash,
#boot {
  background: #0000a5;
  color: #fff;
  border: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: clamp(24px, 8vw, 120px);
  overflow-y: auto;
}

#crash h2,
#boot h2 {
  margin: 36px 0;
  font-size: clamp(32px, 5vw, 56px);
}

#crash button,
#boot button {
  margin-top: 32px;
}

#boot {
  background: #111;
}

#boot pre {
  background: transparent;
  box-shadow: none;
  padding: 0;
  border: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 32px 0;
}

#boot-progress {
  display: block;
  width: min(100%, 480px);
  height: 24px;
  margin-top: 24px;
  accent-color: #5686df;
}

#crash :focus-visible,
#boot :focus-visible {
  outline-color: white;
}

.article-shell {
  max-width: 820px;
  margin: 32px auto;
  padding: 0 16px;
}

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

@media (max-width: 740px) {
  .site-shell {
    padding: 20px 12px;
  }

  header h1 {
    font-family: "VT323", monospace;
    min-height: 1em;
    font-size: clamp(44px, 10vw, 68px);
  }

  .windows {
    display: flex;
    flex-direction: column;
  }

  .windows > * {
    width: 100%;
  }

  .window-body {
    padding: 18px;
  }

  .publication-scroll {
    height: min(540px, 70dvh);
  }

  .publications li {
    padding: 18px 14px;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .windows {
    display: block;
  }

  [data-window][hidden] {
    display: block !important;
  }

  .publication-scroll,
  .blog-scroll {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  nav,
  .close,
  dialog,
  footer {
    display: none !important;
  }
}

#typed-name {
  white-space: pre;
}

.cursor {
  animation: cursor-blink 1s step-end 5;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

#open-photo {
  display: block;
  margin: 10px;
  cursor: zoom-in;
}

#photo-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: 90dvh;
  overflow: auto;
}

#expanded-photo {
  display: block;
  height: auto;
  max-height: min(65dvh, 600px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin: auto;
}

#photo-dialog figcaption {
  padding: 16px 0 0;
  text-align: center;
}

.publication-frame {
  display: flex;
  margin: 8px;
  overflow: hidden;
}

.publication-frame .publication-scroll {
  flex: 1;
  min-width: 0;
  border: 0;
  margin: 0;
}

#boot {
  font-family: "VT323", monospace;
  font-size: 24px;
  line-height: 1.25;
  padding: 40px;
}

#boot .bios-brand {
  font-size: 36px;
  margin-bottom: 12px;
}

#boot-log {
  min-height: 310px;
}

.bios-footer {
  border-top: 1px solid #aaa;
  padding-top: 14px;
}

#boot.windows-boot {
  background:
    radial-gradient(ellipse at 20% 65%, #ffffffd9 0%, transparent 40%),
    radial-gradient(ellipse at 80% 20%, #ffffffc9 0%, transparent 38%),
    linear-gradient(#4289c7, #c8e4f5 70%, #f5faff);
  color: #162b49;
  text-align: center;
}

#windows-screen {
  max-width: 680px;
  margin: 8vh auto 28px;
}

.boot-logo {
  width: 156px;
  height: 156px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  transform: perspective(500px) rotateY(-16deg) rotate(-8deg);
  margin: 0 auto 28px;
}

.boot-logo i {
  border: 3px solid #17334a;
  background: #e64b35;
  box-shadow: 3px 3px 0 #17334a33;
}

.boot-logo i:nth-child(2),
.boot-logo i:nth-child(6) {
  background: #65ad45;
}

.boot-logo i:nth-child(4),
.boot-logo i:nth-child(8) {
  background: #3487ce;
}

.boot-logo i:nth-child(3),
.boot-logo i:nth-child(7) {
  background: #f4ca36;
}

.boot-wordmark {
  font:
    bold 48px/1.1 Tahoma,
    Arial,
    sans-serif;
}

.boot-wordmark span {
  display: block;
  font:
    20px/1.5 Tahoma,
    Arial,
    sans-serif;
  margin: 12px 0 40px;
}

#boot-progress {
  background: silver;
  margin: auto;
  width: min(100%, 360px);
  height: 28px;
}

#boot-progress > #boot-fill {
  width: 0;
}

#boot.windows-boot :focus-visible {
  outline-color: #183c8a;
}

@media (max-width: 740px) {
  #boot {
    padding: 24px 18px;
    font-size: 20px;
  }
  #boot .bios-brand {
    font-size: 28px;
  }
  #boot-log {
    min-height: 350px;
  }
  .boot-wordmark {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}

#crash {
  font:
    26px/1.5 "VT323",
    monospace;
}

#crash h2 {
  font:
    normal clamp(36px, 5vw, 56px) / 1.2 "VT323",
    monospace;
}

#boot.windows-boot {
  padding-bottom: 80px;
}

#windows-screen #boot-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  padding: 2px;
}

.boot-wordmark {
  font-style: italic;
  font-size: clamp(48px, 8vw, 80px);
  letter-spacing: -2px;
}

.boot-wordmark span {
  font-size: 28px;
  letter-spacing: 4px;
}

.publications li,
.blog-entry {
  display: flow-root;
}

.thumbnail-link {
  float: right;
  margin: 0 0 16px 20px;
}

.content-thumbnail {
  display: block;
  width: 100px;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid #808080;
}

.content-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  margin: 0 auto 24px;
}

@media (max-width: 480px) {
  .thumbnail-link {
    float: none;
    display: table;
    margin: 0 0 16px;
  }

  .content-thumbnail {
    width: 76px;
    max-height: 120px;
  }
}

.blog-entry > time,
#post-content > time,
.article-shell article > time {
  font-size: var(--text-small);
}

.read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: var(--text-body);
}
