/* System 7 desktop over the existing noise backgrounds.
   Loaded only by the public pages. Secret pages stay on style.css. */

body.mac-desktop {
  --mac-stripes: repeating-linear-gradient(
    to bottom,
    #000 0px,
    #000 2px,
    #fff 2px,
    #fff 3px
  );
  padding-top: calc(40px + env(safe-area-inset-top));
  color: #fff;
  letter-spacing: 0;
  line-height: 1.35;
}

body.mac-desktop ::selection {
  background: #fff;
  color: #000;
}

/* ---- menu bar ---- */

body.mac-desktop header {
  background: transparent;
  padding: 16px 0 0;
  z-index: 1;
}

.mac-menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: calc(40px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0;
  background: #000;
  color: #fff;
  border-bottom: 1px solid #fff;
  font-size: 24px;
  line-height: 40px;
  letter-spacing: 0;
  overflow-x: auto;
  scrollbar-width: none;
  user-select: none;
}

.mac-menubar::-webkit-scrollbar {
  display: none;
}

.mac-apple {
  flex: 0 0 auto;
  display: block;
  width: 24px;
  height: 28px;
  margin: 0 16px 0 8px;
}

.mac-appname {
  flex: 0 0 auto;
  font-weight: bold;
  padding: 0 0px 0 8px;
  line-height: 40px;
}

.mac-menubar nav {
  flex: 0 0 auto;
}

.mac-menubar nav ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
  width: auto;
  max-width: none;
}

.mac-menubar nav ul li {
  margin: 0;
  white-space: nowrap;
}

.mac-menubar nav ul li a {
  color: #fff;
  font-size: 24px;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: none;
  padding: 0 20px;
  margin: 0;
  border: 0;
  border-radius: 0;
  line-height: 40px;
  display: inline-block;
  background: transparent;
}

.mac-menubar nav ul li a:hover,
.mac-menubar nav ul li a:focus-visible,
.mac-menubar nav ul li a.active {
  background: #fff;
  color: #000;
  transform: none;
  animation: none;
  box-shadow: none;
  text-shadow: none;
  border: 0;
}

.mac-clock {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0 16px 0 32px;
  line-height: 40px;
  white-space: nowrap;
}

/* ---- windows ---- */

body.mac-desktop main {
  width: 100%;
  padding: 0 0 4px;
  overflow-x: hidden;
}

body.mac-desktop main > section,
body.mac-desktop .ascii-window,
body.mac-desktop .shore-window {
  width: min(880px, calc(100% - 28px));
  max-width: none;
  margin: 0 auto 20px;
  padding: 14px 12px;
  box-sizing: border-box;
  background: #000;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 0;
  box-shadow: 2px 2px 0 #fff;
  backdrop-filter: none;
  position: relative;
}

body.mac-desktop main > section.mac-window,
body.mac-desktop .ascii-window,
body.mac-desktop .shore-window {
  padding: 0;
  opacity: 0.7;
}

body.mac-desktop header .ascii-window {
  opacity: 0.9;
  /* Star-field gap under "What am I working on now?", before About.
     Change 500px to tune it. The press-me scene hangs in this gap,
     so leave enough room for it. */
  margin-bottom: 500px;
}

body.mac-desktop .ascii-window {
  width: min(720px, calc(100% - 28px));
}

body.mac-desktop .mac-window.is-zoomed {
  width: min(960px, calc(100% - 28px));
}

body.mac-desktop .hero-section,
body.mac-desktop .about-section {
  margin-bottom: 20px;
  padding: 14px 12px;
  background: #000;
  border-radius: 0;
}

body.mac-desktop .about-section.mac-window,
body.mac-desktop .hero-section.mac-window {
  padding: 0;
}

.mac-titlebar {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  height: 40px;
  padding: 0 6px;
  background: var(--mac-stripes);
  border-bottom: 1px solid #fff;
  user-select: none;
  cursor: default;
}

.mac-close,
.mac-zoom {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  justify-self: center;
  border: 1px solid #fff;
  background: #000;
  box-sizing: border-box;
  cursor: default;
  position: relative;
  font: inherit;
}

.mac-close:active,
.mac-close[aria-pressed="true"] {
  background: #fff;
}

.mac-zoom::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid #fff;
  pointer-events: none;
}

.mac-zoom[aria-pressed="true"]::before {
  inset: 1px;
}

.mac-title {
  display: block;
  width: fit-content;
  max-width: min(78%, 520px);
  margin: 0 auto;
  padding: 0 10px;
  background: #fff;
  color: #000;
  font-size: 24px;
  font-weight: normal;
  line-height: 32px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mac-content {
  padding: 16px 18px 20px;
  font-size: 24px;
  line-height: 1.35;
  color: #fff;
}

.window-title-source {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.mac-desktop .mac-window.is-shaded > :not(.mac-titlebar) {
  display: none;
}

body.mac-desktop .mac-content h1,
body.mac-desktop .mac-content h2,
body.mac-desktop .section-title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  text-shadow: none;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 2px 0 12px;
  color: #fff;
}

body.mac-desktop .mac-content p,
body.mac-desktop .about-text {
  color: #fff;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: 0;
}

body.mac-desktop .mac-content a {
  color: #fff;
  text-shadow: none;
}

body.mac-desktop .mac-content a:hover,
body.mac-desktop .mac-content a:focus-visible {
  color: #fff;
  text-shadow: none;
}

body.mac-desktop .mac-content img,
body.mac-desktop .mac-content video {
  max-width: 100%;
  height: auto;
  border: 1px solid #fff;
  box-shadow: 2px 2px 0 #fff;
  box-sizing: border-box;
}

body.mac-desktop .about-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

body.mac-desktop .about-pane {
  min-width: 0;
  padding: 4px 16px 8px;
}

body.mac-desktop .about-pane + .about-pane {
  border-left: 1px solid #fff;
}

body.mac-desktop .about-pane .about-text {
  text-align: left;
}

body.mac-desktop .about-image {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 16px;
  opacity: 1;
  filter: none;
  background: #2a2a2a;
}

body.mac-desktop .about-portrait {
  width: 200px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto 16px;
  border: 1px solid #fff;
  box-shadow: 2px 2px 0 #fff;
  box-sizing: border-box;
}

body.mac-desktop .about-portrait .about-image {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  border: 0;
  box-shadow: none;
}

body.mac-desktop iframe {
  display: block;
  max-width: 100%;
  margin: 10px 0;
  border: 1px solid #fff;
  border-radius: 0;
  box-shadow: 2px 2px 0 #fff;
  box-sizing: border-box;
}

body.mac-desktop iframe[src*="open.spotify.com"] {
  width: 100%;
  height: 680px;
  margin: 0;
}

/* ---- ascii beach ---- */

.ascii-screen {
  background: #000;
  overflow: hidden;
}

.ascii-stage {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 8px 4px;
  box-sizing: border-box;
  background: #000;
  color: #f4fbff;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: pre;
  text-align: left;
  overflow: hidden;
  user-select: none;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.75),
    0 0 14px rgba(190, 230, 255, 0.45);
}

.ascii-title {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 8px 12px;
  box-sizing: border-box;
  background: #000;
  color: #fff;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  text-align: left;
  overflow: hidden;
  user-select: none;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.75),
    0 0 14px rgba(190, 230, 255, 0.45);
}

.ascii-title span {
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.75),
    0 0 14px rgba(190, 230, 255, 0.45);
}

.ascii-title .core {
  color: #fff;
  text-shadow:
    0 0 8px #fff,
    0 0 20px rgba(255, 255, 255, 0.95);
}

/* ---- links ---- */

body.mac-desktop .about-pane .social-media {
  margin-top: 18px;
}

body.mac-desktop .social-media {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 6px 4px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
  backdrop-filter: none;
  width: auto;
  max-width: none;
}

body.mac-desktop .social-media a {
  margin: 0;
  filter: none;
  line-height: 1;
  text-decoration: none;
  color: #fff;
}

body.mac-desktop .social-media a img {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  filter: none;
}

body.mac-desktop .social-media a:hover,
body.mac-desktop .social-media a:hover img {
  transform: none;
  animation: none;
  filter: none;
  opacity: 0.55;
  box-shadow: none;
}

/* ---- nested project windows ---- */

body.mac-desktop .project-tray {
  border: 1px solid #fff;
  margin: 0 0 14px;
  background: #000;
  box-shadow: 1px 1px 0 #fff;
}

body.mac-desktop .project-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 120px 0 40px;
  background: var(--mac-stripes);
  cursor: pointer;
}

body.mac-desktop .project-header::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 9px;
  width: 20px;
  height: 20px;
  border: 1px solid #fff;
  background: #000;
  box-sizing: border-box;
}

body.mac-desktop .project-header:hover {
  background: var(--mac-stripes);
}

body.mac-desktop .project-header h3 {
  margin: 0;
  padding: 0 8px;
  background: #fff;
  color: #000;
  font-size: 24px;
  font-weight: normal;
  line-height: 32px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mac-desktop .toggle-button {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  right: 8px;
  top: 8px;
  margin: 0;
  padding: 0 8px;
  background: #000;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  line-height: 22px;
  cursor: pointer;
  box-shadow: none;
  animation: none;
}

body.mac-desktop .project-content {
  padding: 10px;
  color: #fff;
}

/* ---- astronomy stays a dark screen inside the window ---- */

body.mac-desktop .lunar-intro {
  color: #fff;
}

body.mac-desktop .lunar-source-link,
body.mac-desktop .lunar-source-link:hover {
  color: #fff;
}

body.mac-desktop .lunar-guide {
  background: #10140f;
  color: #e8e4d8;
  border: 1px solid #fff;
  box-shadow: inset 0 0 0 1px #2a2a28;
}

body.mac-desktop .lunar-guide h3,
body.mac-desktop .lunar-guide p,
body.mac-desktop .lunar-phase-name,
body.mac-desktop .lunar-meta-line,
body.mac-desktop .lunar-month-title,
body.mac-desktop .lunar-planets,
body.mac-desktop .lunar-planet-row,
body.mac-desktop .lunar-planet-name,
body.mac-desktop .lunar-planet-stats {
  color: #e8e4d8;
}

body.mac-desktop .lunar-month-note,
body.mac-desktop .lunar-loc-status {
  color: rgba(232, 228, 216, 0.62);
}

/* Home page: press-me, then a cataclysmic variable in the star-field gap. */

.nova-stage {
  position: absolute;
  left: 50%;
  top: calc(100% + 36px);
  transform: translateX(-50%);
  z-index: 2;
  width: min(640px, calc(100% - 28px));
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
  pointer-events: auto;
}

.nova-slot {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 0;
}

.nova-press {
  visibility: hidden;
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.05;
  white-space: pre;
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.85),
    0 0 18px rgba(255, 220, 160, 0.45);
  animation: nova-idle 2.6s ease-in-out infinite;
}

.nova-stage.is-live .nova-press {
  visibility: visible;
}

.nova-stage.is-live .nova-press.is-gone {
  visibility: hidden;
  animation: none;
}

.nova-press:hover,
.nova-press:focus-visible {
  background: rgba(0, 0, 0, 0.62);
  text-shadow:
    0 0 10px #fff,
    0 0 22px rgba(255, 230, 180, 0.9);
}

.nova-press:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 4px;
}

.nova-press:active {
  transform: translateY(1px);
}

.nova-burst,
.nova-sky {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: pre;
  text-align: left;
  user-select: none;
  pointer-events: none;
}

.nova-burst {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 3;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 180, 80, 0.8);
}

.nova-burst.is-pop {
  position: fixed;
  z-index: 8;
  margin: 0;
  max-width: none;
  overflow: visible;
  transform: translate(-50%, -50%);
}

.nova-sky {
  margin-top: 4px;
  padding: 6px 10px 2px;
  color: #f4fbff;
  pointer-events: auto;
  cursor: pointer;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.28) 58%, rgba(0, 0, 0, 0) 100%);
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.75),
    0 0 14px rgba(190, 230, 255, 0.45);
}

.nova-sky .n-w,
.nova-burst .n-b {
  color: #fff;
  text-shadow: 0 0 8px #fff, 0 0 16px rgba(255, 255, 255, 0.85);
}

.nova-sky .n-i { color: #fff; text-shadow: 0 0 8px #fff, 0 0 16px rgba(220, 245, 255, 0.85); }
.nova-sky .n-d { color: #d8f3ff; text-shadow: 0 0 8px rgba(170, 220, 255, 0.8); }
.nova-sky .n-h { color: #fff6c8; text-shadow: 0 0 8px #ffe9a0, 0 0 16px rgba(255, 220, 140, 0.7); }
.nova-sky .n-s { color: #ffc48a; text-shadow: 0 0 8px rgba(255, 160, 80, 0.75); }
.nova-sky .n-c { color: #ffe7d0; text-shadow: 0 0 8px #ffc890, 0 0 14px rgba(255, 190, 120, 0.65); }
.nova-sky .n-m { color: #ffe0c0; text-shadow: 0 0 8px rgba(255, 190, 120, 0.7); }

.nova-burst .n-y { color: #fff1b0; text-shadow: 0 0 8px #ffe080; }
.nova-burst .n-o { color: #ff9a3c; text-shadow: 0 0 8px #ff7a30; }
.nova-burst .n-r { color: #ff4d3a; text-shadow: 0 0 8px #ff3a28; }

@keyframes nova-idle {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 255, 255, 0.35), 0 0 14px rgba(255, 200, 120, 0.25); }
  50% { text-shadow: 0 0 12px #fff, 0 0 26px rgba(255, 220, 150, 0.85); }
}

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

body.mac-desktop #noiseCanvas.noise-lite {
  opacity: 0.92;
}

/* Home page: galaxies, nebula, and pressure swells on black. */
#pressureField {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: #000;
}

/* ---- footer + visit counter ---- */

body.mac-desktop footer {
  background: transparent;
  padding: 2px 0 18px;
}

.visit-counter {
  margin: 8px 0 0;
  min-height: 1em;
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 0 1px 1px #000;
}

@media (max-width: 600px) {
  body.mac-desktop main > section,
  body.mac-desktop .ascii-window,
  body.mac-desktop .shore-window,
  body.mac-desktop .mac-window.is-zoomed {
    width: calc(100% - 20px);
  }

  body.mac-desktop .social-media {
    width: auto;
    margin: 0;
    padding: 6px 4px 2px;
  }

  body.mac-desktop .social-media a img {
    width: 40px !important;
    height: auto;
    filter: none;
  }

  body.mac-desktop .mac-content {
    padding: 10px 10px 14px;
  }

  body.mac-desktop .about-split {
    grid-template-columns: 1fr;
  }

  body.mac-desktop .about-pane + .about-pane {
    border-left: 0;
    border-top: 1px solid #fff;
    margin-top: 8px;
    padding-top: 12px;
  }

  body.mac-desktop .ascii-title,
  body.mac-desktop .ascii-stage {
    padding: 6px 4px;
    line-height: 1;
  }
}
