@font-face {
  font-family: 'Windows XP Tahoma';
  src: url('../fonts/windows-xp-tahoma.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html.project-document,
body.project-page {
  width: 100%;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  transition: background-color .5s ease;
}

body.project-page {
  --project-footer-space: clamp(90px, 8vw, 160px);
  font-family: 'Windows XP Tahoma', Tahoma, sans-serif;
  background: #000 url('../images/blogbackground.png') center / cover no-repeat;
  color: #000;
  isolation: isolate;
  cursor: url('../images/cursors/default.png') 1 1, auto;
}

body.project-page [hidden] { display: none !important; }

body.project-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
}

html.theme-prepared body.project-page::before {
  background-image: url('../images/blogbackground_dark.png');
}

html.dark-mode body.project-page.dark-background-ready::before { opacity: 1; }

.project-page a[href],
.project-page button:not(:disabled) {
  cursor: url('../images/cursors/link.png') 8 0, pointer !important;
}

.project-desktop {
  position: absolute;
  inset: 48px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  transition: none;
}

.project-half {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 28px clamp(16px, 2.2vw, 40px) var(--project-panel-bottom-padding, calc(var(--project-footer-space) + 28px));
  transition: background-color .5s ease;
}

.project-half-information {
  position: relative;
  z-index: 1;
  background-color: #ECE9D8;
  box-shadow: -18px 0 32px -18px rgba(0, 0, 0, .8);
}
html.dark-mode .project-half-information { background-color: #1F1A31; }

.project-detail-window {
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  height: min(var(--project-window-height, 580px), 100%);
  min-width: 0;
  min-height: 0;
  background: #f5f4f0;
  transition: none;
}

.project-images-window { --project-window-height: 420px; }
.project-detail-window > .title-bar { flex-shrink: 0; }
.project-window-heading { display: flex; align-items: center; gap: 8px; }
.project-window-heading img { image-rendering: pixelated; }

.project-window-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 8px;
  transition: none;
}

.project-detail-fieldset {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: 99%;
  margin: 15px auto 0;
  padding: 12px 8px 8px;
  border: 1.5px groove #8e8e8e;
  border-radius: 0;
  background: linear-gradient(to bottom, #fcfcfe 0%, #f4f3ee 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  overflow: hidden;
  transition: none;
}

.project-detail-fieldset legend {
  max-width: 100%;
  padding: 0 4px;
  font: 500 16px 'Windows XP Tahoma', Tahoma, sans-serif;
  color: #0046D5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-media-scroll,
.project-info-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #7c9bd3 #ece9d8;
  transition: none;
}

.project-media-scroll { display: flex; flex-direction: column; gap: 12px; scroll-snap-type: y proximity; }
.project-detail-image {
  display: block;
  flex: 0 0 100%;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  scroll-snap-align: start;
  transition: none;
}
.project-info-scroll { padding: 4px 12px 8px; overflow-wrap: anywhere; }

/* A fixed preview with a three-image filmstrip, scoped to the project gallery. */
.project-image-picker {
  container-type: size;
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}
.project-image-stage {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #aca899;
  box-shadow: inset 1px 1px #ece9d8;
}
#projectImageOpen:hover,
#projectImageOpen:active { background: #fff; border-color: #0053f0; }
.project-image-enlarge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  background: #ece9d8;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #aca899;
  color: #0046d5;
  font: 14px 'Windows XP Tahoma', Tahoma, sans-serif;
  pointer-events: none;
}
#projectSelectedImage { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; transition: none; }
.project-thumbnails {
  --thumbnail-size: min(96px, 25cqw, calc((100cqh - 16px) / 3));
  display: flex;
  flex: 0 0 var(--thumbnail-size);
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.project-thumbnail {
  position: relative;
  flex: none;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: 3px;
  overflow: hidden;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  background: #ece9d8;
  box-shadow: inset 1px 1px #fff, inset -1px -1px #aca899;
  transition: none;
}
.project-thumbnail img { display: block; position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: cover; transition: none; }
.project-thumbnail:hover { border-color: #0053f0; background: #dce8fa; }
.project-thumbnail[aria-pressed="true"] { border-color: #003cbd; background: #316ac5; box-shadow: inset 0 0 0 2px #316ac5; }
.project-thumbnail-number { position: absolute; right: 3px; bottom: 3px; padding: 1px 4px; background: #ece9d8; color: #333; font: 14px/1.2 'Windows XP Tahoma', Tahoma, sans-serif; }
.project-thumbnail[aria-pressed="true"] .project-thumbnail-number { background: #316ac5; color: #fff; }
.project-image-status { flex: none; margin: 6px 0 0; padding: 3px 6px; border: 1px solid; border-color: #aca899 #fff #fff #aca899; color: #555; font: 14px/1.1 'Windows XP Tahoma', Tahoma, sans-serif; }

/* Luna-style scrollbars shared by Project Information and Blog Information.
   Keep native scrolling and keyboard support inside the information windows. */
.project-info-scroll {
  scrollbar-width: auto;
  scrollbar-color: #bfd3f3 #f1efe8;
}

/* Chromium/Safari need the standard color reset to render the detailed skin. */
@supports selector(::-webkit-scrollbar) {
  .project-info-scroll { scrollbar-color: auto; }
}

.project-info-scroll::-webkit-scrollbar { width: 17px; height: 17px; }
.project-info-scroll::-webkit-scrollbar-track {
  border: 1px solid #fff;
  background: linear-gradient(90deg, #e5e5df, #f5f4ef);
}
.project-info-scroll::-webkit-scrollbar-thumb {
  min-height: 28px;
  border: 1px solid #7c9bc6;
  border-radius: 2px;
  background-color: #bfd3f3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='9' shape-rendering='crispEdges'%3E%3Cpath d='M1 2h6M1 5h6M1 8h6' stroke='%23edf4ff'/%3E%3Cpath d='M1 1h6M1 4h6M1 7h6' stroke='%23758eb9'/%3E%3C/svg%3E"), linear-gradient(90deg, #ffffff80, #ffffff00);
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 1px 1px #f4f8ff, inset -1px -1px #a4bce3;
}
.project-info-scroll::-webkit-scrollbar-thumb:hover { background-color: #d2e2fa; }
.project-info-scroll::-webkit-scrollbar-thumb:active { background-color: #9fbde9; }
.project-info-scroll::-webkit-scrollbar-button { display: none; }
.project-info-scroll::-webkit-scrollbar-button:vertical:single-button {
  display: block;
  width: 17px;
  height: 17px;
  border: 1px solid #7c9bc6;
  border-radius: 2px;
  background-color: #c3d6f5;
  background-image: var(--scrollbar-arrow), linear-gradient(135deg, #ffffffb3, #ffffff00);
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: inset 1px 1px #f4f8ff, inset -1px -1px #a4bce3;
}
.project-info-scroll::-webkit-scrollbar-button:vertical:single-button:decrement {
  --scrollbar-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 3h1V2h1V1h1V0h1v1h1v1h1v1h1v1H0Z' fill='%234b6897'/%3E%3C/svg%3E");
}
.project-info-scroll::-webkit-scrollbar-button:vertical:single-button:increment {
  --scrollbar-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1H6v1H5v1H4v1H3V3H2V2H1V1H0Z' fill='%234b6897'/%3E%3C/svg%3E");
}
.project-info-scroll::-webkit-scrollbar-button:vertical:single-button:hover { background-color: #d8e7fc; }
.project-info-scroll::-webkit-scrollbar-button:vertical:single-button:active {
  background-color: #9fbde9;
  box-shadow: inset 1px 1px #7c9bc6;
}
.project-info-scroll::-webkit-scrollbar-corner { background: #ece9d8; }

.project-page .window-body :is(#projectTitle, #blogTitle) {
  font-family: 'Windows XP Tahoma', Tahoma, sans-serif !important;
  font-size: 44px;
  font-weight: normal;
  color: #000;
  line-height: 1.1;
  margin: 0;
  letter-spacing: .2px;
  text-shadow: 1px 1px 0 #fff, 0 0 1px #000;
  text-align: center;
}

.project-page :is(#projectSubtitle, #blogSubtitle) {
  font: 100 24px/1.25 'Windows XP Tahoma', Tahoma, sans-serif;
  color: #0046D5;
  margin: 0 0 6px;
  text-align: center;
}

.project-detail-meta { margin: -8px 0 16px; font-size: 16px; color: #666; text-align: center; }
.project-story { font: 20px/1.45 'Windows XP Tahoma', Tahoma, sans-serif; color: #000000; }
.project-story p { margin: 0 0 16px; font: inherit; color: #000000; }
.project-image-error { margin: 0 0 16px; font: 20px/1.45 'Windows XP Tahoma', Tahoma, sans-serif; color: #333; }
.project-story p:last-child { margin-bottom: 0; }
:is(#projectBodyText, #blogBodyText) { margin-top: 20px; }
.project-body-placeholder-label { display: block; margin-bottom: 8px; font: 14px 'Windows XP Tahoma', Tahoma, sans-serif; color: #000000; }

.project-window-actions { display: flex; justify-content: flex-start; margin-top: 8px; flex-shrink: 0; }
.project-visit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 12px;
  border: 1px solid #003cbd;
  border-radius: 3px;
  font: 16px 'Windows XP Tahoma', Tahoma, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.project-page :is(a, button, [tabindex]):focus-visible { outline: 2px dotted #0053f0; outline-offset: 2px; }
.project-page #navbar :is(a, button):focus-visible { outline-color: #fff; }

/* A native modal keeps the background inert and provides Escape/focus handling. */
html.project-document.project-viewer-open,
html.project-document.project-viewer-open body.project-page {
  overflow: hidden !important;
  overscroll-behavior: none;
}
.project-image-viewer {
  width: min(1200px, calc(100vw - 32px));
  height: min(880px, calc(100vh - 32px));
  height: min(880px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  overflow: visible;
}
.project-image-viewer::backdrop { background: rgba(0, 17, 53, .7); }
.project-image-viewer,
.project-image-viewer * { transition: none; }
.project-viewer-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: #f5f4f0;
}
.project-viewer-window > .title-bar { flex-shrink: 0; gap: 12px; }
.project-viewer-window .project-window-heading { min-width: 0; }
#projectViewerTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-viewer-window .title-bar-controls { flex-shrink: 0; }
.project-viewer-window .title-bar-controls button { position: relative; }
.project-viewer-window .title-bar-controls button::after { content: ''; position: absolute; inset: -8px -4px; }
.project-viewer-body { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; margin: 8px; }
.project-viewer-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; flex-shrink: 0; }
.project-viewer-controls { display: flex; gap: 6px; }
.project-viewer-controls button { min-width: 44px; min-height: 44px; padding: 6px 12px; font: 16px 'Windows XP Tahoma', Tahoma, sans-serif; }
.project-viewer-viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #7f9db9;
  background: #fff;
  box-shadow: inset 1px 1px #ece9d8;
  touch-action: none;
  overscroll-behavior: contain;
}
.project-viewer-viewport[data-zoomed="true"] { cursor: grab; }
.project-viewer-viewport.is-panning { cursor: grabbing; }
#projectViewerImage {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  max-width: none;
  max-height: none;
  transform-origin: center;
  pointer-events: none;
  transition: none;
  will-change: transform;
}
.project-viewer-hint { flex-shrink: 0; margin: 6px 0; color: #555; font: 14px/1.25 'Windows XP Tahoma', Tahoma, sans-serif; text-align: center; }
.project-viewer-status { flex-shrink: 0; margin: 0; }
.project-viewer-status .status-bar-field { margin: 0; min-width: 0; padding: 4px 6px; font: 14px/1.2 'Windows XP Tahoma', Tahoma, sans-serif; }
#projectViewerZoom { flex: 0 0 66px; text-align: center; }
@media (max-width: 600px) {
  .project-image-viewer { width: calc(100vw - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); }
  .project-viewer-controls button { padding-inline: 8px; font-size: 14px; }
  .project-viewer-body { margin: 6px; }
}

.project-page-status {
  position: fixed;
  z-index: 2;
  top: 40%;
  left: 50%;
  width: min(420px, calc(100% - 32px));
  transform: translate(-50%, -50%);
}
.project-page-status .window-body { padding: 8px; font-size: 20px; }

body.project-page .project-footer {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  opacity: 1;
  transform: none;
  animation: none;
  pointer-events: none;
  user-select: none;
}
.project-footer-grass {
  position: absolute;
  bottom: var(--project-footer-image-bottom, 0px);
  left: var(--project-footer-image-left, 0px);
  display: block;
  width: var(--project-footer-image-width, 100%);
  max-width: none;
  height: auto;
  transition: opacity .5s ease;
}

/* Measured desktop overlap points; retain the original layout at 1536px+. */
@media (min-width: 1101px) and (max-width: 1232px) {
  body.project-page { --project-panel-bottom-padding: 0px; }
}

@media (min-width: 1232px) and (max-width: 1350px) {
  body.project-page { --project-panel-bottom-padding: clamp(0px, calc(68.644068vw - 845.694915px), 81px); }
}

@media (min-width: 1350px) and (max-width: 1454px) {
  body.project-page { --project-panel-bottom-padding: clamp(81px, calc(3.846154vw + 29.076923px), 85px); }
}

@media (min-width: 1454px) and (max-width: 1536px) {
  body.project-page { --project-panel-bottom-padding: clamp(85px, calc(80.341463vw - 1083.164878px), 150.88px); }
}

@media (max-width: 1100px) {
  /* Stack the windows within the document; project stories scroll inside. */
  html.project-document {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: clip !important;
    overflow-y: auto !important;
    overscroll-behavior-y: auto;
  }
  body.project-page {
    /* Interpolate the measured 914px and 1100px overlap points. */
    --project-panel-bottom-padding: clamp(104px, calc(12.903226vw - 13.935484px), 128px);
    --project-footer-image-width: 121.5%;
    --project-footer-image-bottom: -6px;
    --project-footer-image-left: 0px;
    position: relative;
    height: auto !important;
    min-height: 100dvh !important;
    overflow: visible !important;
    overflow-x: clip !important;
    overscroll-behavior-y: auto;
    background-size: auto max(100svh, 49.64vw);
    background-position: center bottom;
  }
  body.project-page::before {
    position: absolute;
    top: auto;
    bottom: 0;
    height: max(100svh, 49.64vw);
  }
  .project-desktop { position: relative; inset: auto; display: block; padding-top: 48px; }
  .project-half-images {
    position: relative;
    z-index: 1;
    padding: 40px 24px 36px;
    background-color: #ECE9D8;
    box-shadow: 0 18px 32px -18px rgba(0, 0, 0, .8);
  }
  html.dark-mode .project-half-images { background-color: #1F1A31; }
  .project-half-information {
    padding: 36px 24px var(--project-panel-bottom-padding, max(160px, calc(20.6vw + 24px)));
  }
  .project-half-information,
  html.dark-mode .project-half-information {
    z-index: auto;
    background-color: transparent;
    box-shadow: none;
  }
  /* Each section includes its window and padding; their backgrounds meet. */
  #projectLayout .project-half-images { box-shadow: none; }
  #projectLayout .project-half-information {
    isolation: isolate;
    background: #000 url('../images/blogbackground.png') center bottom / cover no-repeat;
  }
  #projectLayout .project-half-information::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: center bottom / cover no-repeat;
    opacity: 0;
    pointer-events: none;
    transition: opacity .5s ease;
  }
  html.theme-prepared #projectLayout .project-half-information::before {
    background-image: url('../images/blogbackground_dark.png');
  }
  html.dark-mode body.dark-background-ready #projectLayout .project-half-information::before { opacity: 1; }
  .project-detail-window { height: auto; }
  .project-window-body { flex: none; }
  .project-detail-fieldset { display: block; flex: none; margin-top: 8px; overflow: visible; }
  .project-media-scroll,
  .project-info-scroll { flex: none; overflow: visible; overscroll-behavior: auto; scroll-snap-type: none; }
  .project-detail-image { flex: none; height: auto; scroll-snap-align: none; }
  .project-image-picker { height: clamp(220px, 58vw, 340px); gap: 8px; }
  .project-info-scroll { padding: 12px 16px 16px; }
  /* Match Hoppin's standard height instead of growing with each story. */
  #projectInfoWindow { height: 485px; }
  #projectInfoWindow .project-window-body { flex: 1; }
  #projectInfoWindow .project-detail-fieldset { display: flex; flex: 1; overflow: hidden; }
  #projectInfoWindow .project-info-scroll {
    flex: 1;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .project-window-actions { justify-content: center; }
  body.project-page .project-footer { position: absolute; }
  .project-footer-grass { width: var(--project-footer-image-width, max(100%, 640px)); }
}

@media (max-width: 914px) {
  /* Interpolate the measured 690px and 914px overlap points. */
  body.project-page { --project-panel-bottom-padding: clamp(79px, calc(11.160714vw + 1.991071px), 104px); }
}

@media (max-width: 690px) {
  /* Blend to the 590px measurements, retaining those values below 590px. */
  body.project-page {
    --project-panel-bottom-padding: clamp(79px, calc(182.5px - 15vw), 94px);
    /* Interpolate rendered width: 838.35px at 690px to 933.97px at 590px. */
    --project-footer-image-width: clamp(121.5%, calc(1498.128px - 95.62vw), 158.3%);
    --project-footer-image-left: clamp(-61px, calc(61vw - 420.9px), 0px);
  }
}

@media (max-width: 600px) {
  #projectInfoWindow { height: 580px; }
  .project-half-images { padding: 24px 16px 28px; }
  .project-half-information { padding: 28px 16px var(--project-panel-bottom-padding, 160px); }
  .project-window-body { margin: 6px; }
  .project-detail-fieldset { margin-top: 4px; padding: 6px; }
  .project-info-scroll { padding: 12px 8px; }
  .project-page :is(#projectSubtitle, #blogSubtitle) { font-size: 22px; }
  .project-detail-meta { margin-bottom: 12px; }
  .project-visit-link { min-height: 32px; font-size: 14px; }
  .project-window-actions { margin-top: 6px; }
}

@media (max-width: 599px) and (max-height: 600px) {
  .project-page :is(#projectSubtitle, #blogSubtitle) { font-size: 20px; }
  .project-detail-meta { font-size: 14px; line-height: 1.2; margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .project-page::before,
  .project-half,
  .project-page .project-footer-grass { transition: none !important; }
}
