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

html, body {
  background: #000000;
  color: #e8e4dc;
  font-family: 'Share Tech Mono', monospace;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.hero-logo-wrap {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: flex-end;
}

.hero-logo {
  position: relative;
  width: min(520px, 82vw);
  image-rendering: pixelated;
  opacity: 0;
  animation: fadein 1s 0.3s forwards;
  display: block;
}

.hero-cursor {
  position: absolute;
  right: -83px;
  bottom: 8px;
  width: 75px;
  height: 14px;
  background: #e8e4dc;
  opacity: 0;
  animation: fadein 0s 1.4s forwards, blink 1.1s 1.4s step-end infinite;
}

.hero-name {
  font-family: 'IM Fell English', serif;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 400;
  color: #e8e4dc;
  letter-spacing: 0.06em;
  opacity: 0;
  animation: fadein 1s 0.6s forwards;
}

.hero-email {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  text-decoration: none;
  color: #e8e4dc;
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  opacity: 0;
  animation: fadein 0.8s 0.8s forwards;
  transition: opacity 0.2s;
}

.hero-email:hover { opacity: 0.7; }
.hero-email img { width: 22px; height: 22px; object-fit: contain; }

.socials {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  opacity: 0;
  animation: fadein 0.8s 0.9s forwards;
  margin-top: 1.6rem;
}

.socials a {
  display: flex;
  align-items: center;
  opacity: 1;
  transition: opacity 0.2s;
  text-decoration: none;
}

.socials a:hover { opacity: 0.6; }
.socials a img { width: 18px; height: 18px; object-fit: contain; }

/* dock */
.dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  padding: 10px 18px;
  border: 1px solid #222;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.02);
  opacity: 0;
  animation: fadein 0.8s 1.1s forwards;
  z-index: 900;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s;
  text-decoration: none;
  color: #e8e4dc;
}

.dock-item:hover { background: rgba(255, 255, 255, 0.06); }
.dock-item.active { background: rgba(255, 255, 255, 0.08); }
.dock-item img { width: 32px; height: 32px; object-fit: contain; }
.dock-item span { font-size: 0.6rem; letter-spacing: 0.1em; color: #ccc; }
.dock-item:hover span, .dock-item.active span { color: #fff; }

.dock-item .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e8e4dc;
  opacity: 0;
  transition: opacity 0.2s;
}

.dock-item.active .dot { opacity: 1; }

/* window */
.window {
  position: absolute;
  background: #000000;
  border: 1px solid #222;
  display: none;
  flex-direction: column;
  min-width: 400px;
  min-height: 300px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.window.open { display: flex; }

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border: none;
}

.window-titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  background: #000000;
  border-bottom: 1px solid #222;
  padding: 0 10px;
  cursor: grab;
  flex-shrink: 0;
}

.window-titlebar:active { cursor: grabbing; }

.window-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #e8e4dc;
  flex: 1;
}

.window-controls { display: flex; gap: 2px; }

.window-btn {
  width: 28px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555;
  font-size: 0.7rem;
  transition: background 0.15s, color 0.15s;
  border-radius: 2px;
}

.window-btn:hover { background: rgba(255, 255, 255, 0.08); color: #e8e4dc; }
.window-btn.close:hover { background: #c42b1c; color: #fff; }

.window-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.window-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.window-resize::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #333;
  border-bottom: 2px solid #333;
}

/* gallery */
.gallery-header { padding: 1.2rem 1.4rem 0.8rem; }

.gallery-header h2 {
  font-family: 'IM Fell English', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.gallery-header p {
  font-size: 0.75rem;
  color: #e8e4dc;
  letter-spacing: 0.1em;
  line-height: 1.7;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: 1px solid #282828;
  color: #aaa;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.tab-btn:hover { border-color: #666; color: #e8e4dc; }
.tab-btn.active { border-color: #e8e4dc; color: #fff; }

.gallery {
  columns: 3;
  column-gap: 5px;
  padding: 5px;
  visibility: hidden;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 5px;
  cursor: pointer;
  overflow: hidden;
  display: block;
}

.gallery-item.hidden { display: none; }
.gallery-item.pending { opacity: 0; visibility: hidden; }

@keyframes popin {
  0% { opacity: 0; transform: scale(0.92); }
  60% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

.gallery-item.popin { animation: popin 0.35s ease both; }
.gallery-item img { width: 100%; display: block; transition: opacity 0.3s; }
.gallery-item:hover img { opacity: 0.7; }

/* window footer */
.window-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  border-top: none;
  flex-shrink: 0;
  transition: height 0.3s, border-top 0.3s;
}

.window-footer.visible {
  height: 40px;
  border-top: 1px solid #222;
}

.win-back-to-top {
  background: none;
  border: none;
  color: #e8e4dc;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: opacity 0.2s;
  opacity: 0.5;
  padding: 0;
}

.win-back-to-top:hover { opacity: 1; }

/* apod */
.apod-content { padding: 1.4rem; }

.apod-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 0.12em;
}

.apod-image-wrap { width: 100%; margin-bottom: 1.2rem; }
.apod-image-wrap img { width: 100%; display: block; cursor: pointer; transition: opacity 0.3s; }
.apod-image-wrap img:hover { opacity: 0.8; }
.apod-image-wrap iframe { width: 100%; aspect-ratio: 16/9; border: none; }

.apod-title {
  font-family: 'IM Fell English', serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.apod-date {
  font-size: 0.7rem;
  color: #aaa;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
}

.apod-desc {
  font-size: 0.78rem;
  color: #e8e4dc;
  line-height: 1.8;
  letter-spacing: 0.04em;
}

.apod-credit {
  margin-top: 1.2rem;
  font-size: 0.6rem;
  color: #888;
  letter-spacing: 0.1em;
}

.apod-credit a { color: #aaa; text-decoration: none; transition: color 0.2s; }
.apod-credit a:hover { color: #fff; }

/* weather */
.weather-content { padding: 1.4rem; }

.weather-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.weather-search input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  color: #e8e4dc;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  padding: 8px 12px;
  letter-spacing: 0.08em;
  outline: none;
}

.weather-search input:focus { border-color: #555; }

.weather-search button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #333;
  color: #e8e4dc;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 0.1em;
}

.weather-search button:hover { background: rgba(255, 255, 255, 0.1); }

.weather-loading {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 0.12em;
}

.weather-current { margin-bottom: 1.4rem; }

.weather-city {
  font-size: 0.7rem;
  color: #aaa;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.weather-temp {
  font-family: 'IM Fell English', serif;
  font-size: 2.4rem;
  color: #fff;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.weather-condition {
  font-size: 0.8rem;
  color: #ccc;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}

.weather-details {
  display: flex;
  gap: 1.5rem;
  font-size: 0.65rem;
  color: #888;
  letter-spacing: 0.1em;
}

.weather-forecast {
  display: flex;
  gap: 0;
  border-top: 1px solid #222;
  padding-top: 1rem;
}

.weather-day {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0;
}

.weather-day-name {
  font-size: 0.6rem;
  color: #888;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}

.weather-day-condition {
  font-size: 0.55rem;
  color: #aaa;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.weather-day-temps {
  font-size: 0.65rem;
  color: #ccc;
  letter-spacing: 0.08em;
}

/* news */
.news-content { padding: 1.4rem; }

.news-loading {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 0.12em;
}

.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.6rem;
  color: #888;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #444;
}

.news-header span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.news-refresh {
  background: none;
  border: 1px solid #444;
  color: #888;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  cursor: pointer;
}

.news-refresh:hover { color: #fff; border-color: #666; }

.news-header img {
  height: 24px;
}

.news-item {
  display: block;
  padding: 0.7rem 0;
  border-bottom: 1px solid #333;
  text-decoration: none;
  color: #fff;
  transition: background 0.15s;
  cursor: pointer;
}

.news-item:hover { background: rgba(255, 255, 255, 0.03); }

.news-title {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #fff;
  margin-bottom: 0.25rem;
}

.news-item:hover .news-title { color: #fff; }

.news-time {
  font-size: 0.6rem;
  color: #666;
  letter-spacing: 0.1em;
}

.news-footer {
  margin-top: 1rem;
  padding-top: 0.6rem;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}

.news-footer a {
  color: #fff;
  text-decoration: none;
}

.news-footer a:hover { color: #fff; }

/* iss tracker */
.iss-loading {
  position: absolute;
  inset: 0;
  z-index: 1001;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}

.iss-loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

.iss-loading-text {
  font-size: 0.75rem;
  color: #aaa;
  letter-spacing: 0.12em;
  animation: fadein 0.6s ease both;
}

#iss-map {
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

.iss-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #222;
  padding: 10px 14px;
  z-index: 1000;
  pointer-events: none;
}

.iss-info-title {
  font-family: 'IM Fell English', serif;
  font-size: 0.78rem;
  color: #fff;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.iss-info-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  line-height: 1.8;
}

.iss-label {
  color: #666;
  min-width: 58px;
}

.iss-info-row span:last-child {
  color: #e8e4dc;
}

.iss-follow-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #222;
  color: #888;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  display: none;
}

.iss-follow-btn:hover {
  color: #e8e4dc;
  border-color: #444;
}

.iss-follow-btn.visible {
  display: block;
}

.iss-marker {
  position: relative;
}

.iss-marker-dot {
  width: 10px;
  height: 10px;
  background: #e8e4dc;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(232, 228, 220, 0.6);
}

.iss-marker-ping {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(232, 228, 220, 0.5);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: iss-ping 2s ease-out infinite;
}

@keyframes iss-ping {
  0% { width: 10px; height: 10px; opacity: 1; }
  100% { width: 40px; height: 40px; opacity: 0; }
}

/* override leaflet attribution */
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #555 !important;
  font-size: 0.45rem !important;
  font-family: 'Share Tech Mono', monospace !important;
  letter-spacing: 0.05em !important;
}

.leaflet-control-attribution a {
  color: #777 !important;
}

.leaflet-control-zoom a {
  background: rgba(0, 0, 0, 0.8) !important;
  color: #888 !important;
  border-color: #333 !important;
  font-size: 14px !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(0, 0, 0, 0.95) !important;
  color: #e8e4dc !important;
}

/* lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
  opacity: 0;
  transition: opacity 0.25s;
}

.lightbox img.loaded { opacity: 1; }

.lightbox-close {
  position: fixed;
  top: 1.4rem;
  right: 1.8rem;
  font-size: 0.58rem;
  color: #555;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.2s;
}

.lightbox-close:hover { color: #e8e4dc; }

.lightbox-prev, .lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.55rem;
  color: #444;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
  padding: 1rem;
}

.lightbox-prev { left: 1.2rem; }
.lightbox-next { right: 1.2rem; }
.lightbox-prev:hover, .lightbox-next:hover { color: #e8e4dc; }

.lightbox-counter {
  position: fixed;
  bottom: 2.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.48rem;
  color: #444;
  letter-spacing: 0.12em;
}

.lightbox-caption {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  color: #e8e4dc;
  letter-spacing: 0.06em;
  text-align: center;
  max-width: 80vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* scrollbar */
.window-body::-webkit-scrollbar { width: 6px; }
.window-body::-webkit-scrollbar-track { background: #000; }
.window-body::-webkit-scrollbar-thumb { background: #222; border-radius: 3px; }
.window-body::-webkit-scrollbar-thumb:hover { background: #333; }

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .hero-logo-wrap {
    top: 6%;
  }

  .hero-logo {
    width: min(320px, 70vw);
  }

  .hero-cursor {
    right: -50px;
    bottom: 5px;
    width: 45px;
    height: 10px;
  }

  .hero-name {
    font-size: clamp(1.6rem, 8vw, 2.4rem);
  }

  .hero-email {
    font-size: clamp(0.8rem, 3vw, 1rem);
  }

  .hero-email img {
    width: 16px;
    height: 16px;
  }

  .socials {
    gap: 0.8rem;
    margin-top: 1.2rem;
  }

  .socials a img {
    width: 16px;
    height: 16px;
  }

  .dock {
    padding: 8px 14px;
    gap: 4px;
  }

  .dock-item {
    padding: 6px 10px;
  }

  .dock-item img {
    width: 26px;
    height: 26px;
  }

  .dock-item span {
    font-size: 0.5rem;
  }

  /* windows always fullscreen on mobile */
  .window.open {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: unset;
    min-height: unset;
    border: none;
    box-shadow: none;
  }

  .window-resize {
    display: none;
  }

  .window-btn.maximize {
    display: none;
  }

  .gallery {
    columns: 2;
    column-gap: 4px;
    padding: 4px;
  }

  .gallery-header {
    padding: 1rem;
  }

  .gallery-header h2 {
    font-size: 1.2rem;
  }

  .gallery-header p {
    font-size: 0.7rem;
  }

  .apod-content {
    padding: 1rem;
  }

  .apod-title {
    font-size: 1.1rem;
  }

  .apod-desc {
    font-size: 0.72rem;
  }

  .iss-info {
    bottom: 8px;
    left: 8px;
    padding: 8px 10px;
  }

  .iss-info-title {
    font-size: 0.7rem;
  }

  .iss-info-row {
    font-size: 0.58rem;
  }

  .iss-follow-btn {
    top: 8px;
    right: 8px;
  }
}
