/* =========================================================
   WINDOW SHELL
   ========================================================= */
.win {
  position: absolute;
  min-width: 260px;
  min-height: 180px;
  background: var(--win-face);
  border: 2px solid var(--win-border);
  border-radius: var(--corner-radius);
  box-shadow: var(--shadow-hard);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  animation: winOpen calc(0.28s / var(--anim-speed)) cubic-bezier(.2,.9,.3,1.2) both;
}
.win.closing { animation: winClose calc(0.2s / var(--anim-speed)) ease forwards; }
.win.minimized { display: none; }
.win.maximized {
  top: 0 !important; left: 0 !important;
  width: 100% !important; height: calc(100% - 44px) !important;
  border-width: 0 0 2px 0;
  border-radius: 0;
}

@keyframes winOpen {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes winClose {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.85) translateY(10px); }
}

.win-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 6px 0 8px;
  background: var(--win-title-inactive);
  color: var(--win-title-text);
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}
.win.active .win-titlebar { background: var(--win-title-active); }

.win-titlebar .win-icon { width: 16px; height: 16px; flex-shrink: 0; }
.win-titlebar .win-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-font="modern"] .win-titlebar .win-title { font-size: 13px; font-weight: 600; }

/* macOS-style traffic-light buttons, left side of the titlebar */
.win-controls { display: flex; gap: 8px; order: -1; margin-right: 4px; }
.win-controls button {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.35);
  padding: 0;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
  font-size: 9px;
  color: transparent;
}
.win-controls .btn-close { background: #ff5f57; }
.win-controls .btn-min   { background: #febc2e; }
.win-controls .btn-max   { background: #28c840; }
.win-controls button:active { filter: brightness(0.85); }
/* tiny glyphs appear on hover, like macOS */
.win-titlebar:hover .win-controls button { color: rgba(0,0,0,0.55); font-weight: bold; }
.win-controls .btn-close:hover::after { content: "×"; }
.win-controls .btn-min:hover::after   { content: "–"; }
.win-controls .btn-max:hover::after   { content: "+"; }
.win-titlebar:hover .win-controls button::after { font-size: 10px; }

.win-body {
  flex: 1;
  overflow: auto;
  padding: 18px;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: var(--win-face);
}
[data-font="modern"] .win-body { font-size: 14px; }

.win-resize-handle {
  position: absolute;
  right: 0; bottom: 0;
  width: 16px; height: 16px;
  cursor: nwse-resize;
  background: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 4px);
  opacity: 0.5;
}
.win.maximized .win-resize-handle { display: none; }

/* =========================================================
   SHARED APP-CONTENT COMPONENTS
   ========================================================= */
.pixel-btn, .btn {
  font-family: var(--font-display);
  font-size: 11px;
  padding: 8px 14px;
  background: var(--lilac);
  color: var(--white);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-soft);
}
[data-font="modern"] .pixel-btn, [data-font="modern"] .btn { font-size: 13px; letter-spacing: 0; }
.pixel-btn:hover, .btn:hover { background: var(--lilac-deep); }
.pixel-btn:active, .btn:active { box-shadow: none; transform: translate(2px,2px); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin: 3px;
  background: var(--cream-deep);
  border: 1px solid var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 4px 0 18px 26px;
  border-left: 2px dashed var(--lilac);
}
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 4px;
  width: 12px; height: 12px;
  background: var(--coral);
  border: 2px solid var(--ink);
}
.timeline .tl-period { font-size: 12px; color: var(--ink-soft); font-family: var(--font-display); }
[data-font="modern"] .timeline .tl-period { font-size: 11px; }
.timeline .tl-title { font-weight: bold; font-size: 18px; margin: 4px 0 2px; }
[data-font="modern"] .timeline .tl-title { font-size: 15px; }
.timeline .tl-place { font-style: italic; color: var(--ink-soft); margin-bottom: 4px; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.skill-card {
  background: var(--cream-deep);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-soft);
  padding: 12px 8px;
  text-align: center;
}
.skill-card .skill-icon { width: 32px; height: 32px; margin: 0 auto 8px; display: block; }
.skill-card .skill-name { font-family: var(--font-body); font-size: 15px; }

/* skill cards wired to a hover-video popup (currently just Valorant) get
   a small play-badge so it's clear there's more than a static icon */
.skill-card--video {
  position: relative;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.skill-card--video:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hard);
}
.skill-card--video::after {
  content: "\25B6";
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  line-height: 1;
  color: var(--white);
  background: var(--coral);
  border: 1px solid var(--ink);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
[dir="rtl"] .skill-card--video::after {
  right: auto;
  left: 4px;
}

.field-row { margin-bottom: 12px; }
.field-row label { display: block; font-family: var(--font-display); font-size: 10px; margin-bottom: 6px; color: var(--ink-soft); }
[data-font="modern"] .field-row label { font-size: 11px; }

/* =========================================================
   FLOATING PREVIEWS (image hover-previews + the Valorant video)
   Rendered as position:fixed overlays appended straight to <body>
   (see js/hover-preview.js) — they float above every window
   instead of being clipped inside whichever window triggered
   them, like a native OS tooltip or an Instagram Reels preview.
   ========================================================= */
.hover-preview-trigger {
  color: var(--coral);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

.floating-popup {
  position: fixed;
  z-index: 9200;
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.floating-popup.visible { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- image variant (education / bio hover previews) ---------- */
.floating-popup--image {
  width: clamp(240px, 34vw, 420px);
  max-width: calc(100vw - 24px);
  padding: 8px;
  background: var(--shadow);
  border: 2px solid var(--ink);
  border-radius: var(--corner-radius);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}
.floating-popup--image img {
  display: block;
  width: 100%;
  max-height: min(42vh, 360px);
  object-fit: contain;
  border: 1px solid var(--ink);
  background: var(--win-face);
  image-rendering: pixelated;
  border-radius: var(--corner-radius);
}

/* ---------- video variant (Valorant skill — Reels-style popup) ---------- */
.floating-popup--video { width: 220px; }
.floating-popup--video .reel {
  position: relative;
  width: 220px;
  aspect-ratio: 9 / 16;
  background: #000;
  border: 3px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-hard);
}
.floating-popup--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.floating-popup--video .reel-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
  pointer-events: none;
}
.floating-popup--video .reel-label {
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.7);
}
[data-font="modern"] .floating-popup--video .reel-label { font-size: 12px; }
.floating-popup--video .reel-label::before {
  content: "";
  width: 8px; height: 8px;
  flex-shrink: 0;
  background: #ff4655;
  border: 1px solid #fff;
}
/* fallback shown until chamber.mp4 is actually dropped into /videos */
.floating-popup--video .reel-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--mint);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: center;
  padding: 12px;
  background: #1a1428;
}
.floating-popup--video .reel-fallback-icon { font-size: 22px; }
.floating-popup--video.no-video video { visibility: hidden; }
.floating-popup--video.no-video .reel-fallback { display: flex; }
