/* ============================================================
   THEME VARIABLES — edit these to re-theme the whole site
   ============================================================ */
:root {
  --bg-glow-1: rgba(160, 40, 40, 0.25);
  --bg-glow-2: rgba(40, 60, 90, 0.3);

  --glass-bg: rgba(20, 20, 24, 0.4);
  --glass-bg-strong: rgba(20, 20, 24, 0.55);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.15);
  --glass-blur: 14px;
  --glass-blur-strong: 16px;

  --header-bg: rgba(10, 10, 12, 0.55);
  --header-blur: 10px;

  --accent-green: #5dcaa5;
  --accent-blue: #85b7eb;
  --accent-coral: #f0997b;
  --accent-pink: #ed93b1;
  --accent-purple: #7f77dd;
  --accent-lime: #97c459;

  --text-primary: #f0f0ec;
  --text-secondary: #c9c9c5;
  --text-muted: #7a7a76;
  --text-faint: #8a8a86;

  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  --transition-fast: 200ms linear;
  --transition-panel: 180ms linear;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-mono);
  background: linear-gradient(
    145deg,
    #1b1b1b 0%,
    #2f171b 25%,
    #52262d 55%,
    #33181c 80%,
    #1d1d1d 100%
  );
  color: var(--text-primary);
  overflow: hidden; /* the app is a single fixed viewport, not a scrolling page */
}

button {
  font-family: inherit;
}

/* ============================================================
   APP SHELL — fixed background, full viewport
   ============================================================ */
.app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;

  /* fixed wallpaper — swap this for a real background-image in production:
     background-image: url('../assets/wallpaper.jpg');
     background-size: cover;
     background-position: center;
     background-attachment: fixed;
  */
  background:
    radial-gradient(circle at 70% 10%, var(--bg-glow-1), transparent 45%),
    radial-gradient(circle at 15% 85%, var(--bg-glow-2), transparent 50%),
    linear-gradient(150deg, #22252d 0%, #14161b 55%, var(--bg-dark) 100%);
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--header-bg);
  backdrop-filter: blur(var(--header-blur));
  -webkit-backdrop-filter: blur(var(--header-blur));
  border-bottom: 0.5px solid var(--glass-border);
}

.prompt-label {
  font-size: 11px;
  color: var(--text-faint);
  margin-right: 8px;
  user-select: none;
}

.nav-btn {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 4px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.nav-btn.active {
  color: var(--accent-green);
  background: rgba(93, 202, 165, 0.15);
}

.nav-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
}

.header-spacer {
  flex: 1;
}

.clock {
  font-size: 11px;
  color: var(--text-faint);
  user-select: none;
}

/* ============================================================
   SCREEN — the single content area (iframe host)
   ============================================================ */
.screen-container {
  flex: 1;
  min-height: 0; /* required so the flex child can actually fill + scroll */
  padding: 22px 24px;
}

.terminal-window {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 0.5px solid var(--glass-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);

  transform-origin: top left;
  transform: scale(1);
  opacity: 1;
  transition:
    transform var(--transition-fast),
    opacity var(--transition-fast);
}

.terminal-window.closing {
  transform: scale(0.85);
  opacity: 0;
}

.window-titlebar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.window-title {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 6px;
}
.screen-body {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.screen-frames {
  position: absolute;
  inset: 0;
}

/* Every cached page gets its own iframe, stacked in the same box.
   Only the .active one is shown — the rest stay mounted (state
   preserved) but invisible and non-interactive. */
.screen-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;

  display: none;

  border: 0;
  outline: none;

  background-color: transparent !important;

  color-scheme: dark;
}

.screen-frame.active {
  display: block;
}

/* ============================================================
   SKELETON — shown over the active frame while its page loads
   ============================================================ */
.screen-skeleton {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
  background: var(--glass-bg-strong);
  pointer-events: none;
}

.screen-skeleton.visible {
  display: flex;
}

.skeleton-line,
.skeleton-block {
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.06) 20%,
    rgba(255, 255, 255, 0.16) 40%,
    rgba(255, 255, 255, 0.06) 60%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
}

.skeleton-block {
  flex: 1;
  min-height: 60px;
}

.skeleton-line.w-40 {
  width: 40%;
}
.skeleton-line.w-70 {
  width: 70%;
}
.skeleton-line.w-55 {
  width: 55%;
}
.skeleton-line.w-60 {
  width: 60%;
}
.skeleton-line.w-35 {
  width: 35%;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================================
   LAUNCHER — floating fab + anchored scrollable panel
   ============================================================ */
.launcher-fab {
  all: unset;
  cursor: pointer;
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(20, 20, 24, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid var(--glass-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 6;
  transition: transform var(--transition-fast);
}

.launcher-fab:hover {
  transform: scale(1.05);
}

.launcher-fab svg {
  width: 19px;
  height: 19px;
  stroke: var(--text-secondary);
}

.click-catcher {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 4;
}

.click-catcher.open {
  display: block;
}

.launcher-panel {
  position: absolute;
  bottom: 72px;
  left: 20px;
  width: 300px;
  max-height: 420px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(140%);
  border: 0.5px solid var(--glass-border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: none;
  z-index: 5;

  transform: scale(0.9) translateY(6px);
  opacity: 0;
  transition:
    transform var(--transition-panel),
    opacity var(--transition-panel);
}

.launcher-panel.open {
  display: block;
}

.launcher-panel.visible {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.launcher-heading {
  font-size: 10px;
  color: var(--text-faint);
  margin: 0;
  padding: 12px 14px 8px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}

.launcher-list {
  /* this is the lazy/scrollable part — grows tall list without resizing the panel */
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.launch-item {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.launch-item:hover,
.launch-item:focus-visible,
.launch-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.launch-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.launch-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.launch-item-text {
  min-width: 0; /* required for text-overflow to work inside a flex child */
}

.launch-item-name {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.launch-item-meta {
  margin: 2px 0 0;
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   LAUNCHER DETAIL — floating panel anchored beside the launcher,
   fed by the same project object as the row currently hovered/focused
   ============================================================ */
.launcher-detail {
  position: absolute;
  bottom: 72px;
  left: 332px; /* launcher-panel left (20px) + width (300px) + gap (12px) */
  width: 260px;
  max-height: 420px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur-strong)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(140%);
  border: 0.5px solid var(--glass-border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 16px;
  z-index: 5;
  pointer-events: none;

  transform: scale(0.94) translateX(-4px);
  opacity: 0;
  transition:
    transform var(--transition-panel),
    opacity var(--transition-panel);
}

.launcher-detail.visible {
  opacity: 1;
  transform: scale(1) translateX(0);
  pointer-events: auto;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.detail-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-icon svg {
  width: 15px;
  height: 15px;
}

.detail-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.detail-date {
  margin: 2px 0 0;
  font-size: 9.5px;
  color: var(--text-faint);
}

.detail-description {
  margin: 0 0 14px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.detail-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 10px;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.detail-github:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
}

.detail-github svg {
  width: 12px;
  height: 12px;
}

@media (max-width: 900px) {
  /* not enough horizontal room to float a second panel beside the
     launcher without it running off-screen — suppress it here rather
     than showing a clipped panel */
  .launcher-detail {
    display: none;
  }
}

/* thin scrollbars matching the theme, no default browser chrome */
.launcher-list::-webkit-scrollbar,
.screen-frame::-webkit-scrollbar {
  width: 6px;
}
.launcher-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.launcher-list::-webkit-scrollbar-track {
  background: transparent;
}
.dot:nth-child(1) {
  background-color: #ff5f57;
}

.dot:nth-child(2) {
  background-color: #febc2e;
}

.dot:nth-child(3) {
  background-color: #28c840;
}

#share-btn {
  all: unset;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 20px;
  height: 20px;
  margin-left: 8px;

  cursor: pointer;
  color: var(--text-muted);

  border-radius: 4px;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease;
}

#share-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

#share-btn:active {
  transform: scale(0.95);
}

#share-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
