/* ============================================================
   Windows XP Portfolio — scroll-driven scenes on top of XP.css
   ============================================================ */

:root {
  --taskbar-height: 34px;
  --start-blue: #245edb;
}

* { box-sizing: border-box; }

html {
  /* Snap each window to centre so you never rest in dead-space */
  scroll-snap-type: y mandatory;
  scroll-padding-bottom: var(--taskbar-height);
}
body {
  margin: 0;
  padding: 0;
  font-family: "Pixelated MS Sans Serif", Tahoma, "Segoe UI", sans-serif;
}

/* ---------- Fixed XP desktop background ---------- */
#desktop-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* Classic XP "Bliss" wallpaper, with a gradient fallback underneath */
  background:
    linear-gradient(to bottom, #5a8edd 0%, #5a8edd 55%, #4a7c3a 55%, #6aa84f 75%, #3f7a2e 100%);
  background-image: url("images/bliss.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ============================================================
   Scenes  — one window per full-height section
   ============================================================ */
#page { width: 100%; }

.scene {
  /* Scene height = window height + a small gap, so the previous/next
     windows always peek in above and below the focused one. */
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 18px;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
.scene.hero { min-height: 100vh; }
/* breathing room so the first/last windows can sit centred */
#scene-about { padding-top: 16vh; }
#scene-contact { padding-bottom: calc(var(--taskbar-height) + 16vh); }
/* Collapse a scene whose window has been closed */
.scene:has(.xp-window.closed) {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

/* ---------- Window animation: grow in + focus ---------- */
.xp-window {
  width: 540px;
  max-width: calc(100vw - 24px);
  max-height: 60vh;            /* small enough that neighbours peek above & below */
  display: flex;
  flex-direction: column;
  box-shadow: 4px 4px 16px rgba(0,0,0,.45);
  opacity: 0;
  transform: scale(.8);
  transform-origin: center center;
  transition: opacity .4s ease, transform .45s cubic-bezier(.2,.85,.25,1.12), filter .4s ease;
  filter: saturate(.5) brightness(.85);
}
/* Revealed but off-centre = a peeking neighbour: visible, shrunk & dimmed */
.xp-window.in-view {
  opacity: .7;
  transform: scale(.88);
}
/* The window centred in the viewport grows to full size & lights up */
.xp-window.active {
  opacity: 1;
  transform: none;
}
/* Tall windows scroll internally instead of overflowing the snap point */
.xp-window > .window-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* The window currently centred in the viewport = focused */
.xp-window.active {
  filter: none;
  box-shadow: 6px 8px 26px rgba(0,0,0,.55);
}
.xp-window.closed { display: none; }

/* Extra "open" pop when you jump to a window via an icon / menu / card */
.xp-window.pop { animation: popGrow .5s cubic-bezier(.2,.85,.25,1.1); }
@keyframes popGrow {
  0%   { transform: scale(.7);  opacity: .35; }
  70%  { transform: scale(1.04); }
  100% { transform: scale(1);   opacity: 1; }
}

/* Inactive (not focused) windows get the grey XP title bar */
.xp-window:not(.active) > .title-bar {
  background: linear-gradient(180deg, #7f7f7f, #aeaeae 8%, #9d9d9d 40%, #8e8e8e);
}

.xp-window.maximized { width: min(960px, calc(100vw - 24px)); }

.title-bar-text { display: flex; align-items: center; gap: 6px; }
.tb-icon { width: 16px; height: 16px; image-rendering: pixelated; }
.tb-emoji { font-size: 14px; }

.window-body {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.window-body p { margin: 0 0 10px; }
.window-body h1 { font-size: 20px; margin: 0; }
.window-body h2 { font-size: 15px; margin: 0; }
.window-body h3 { font-size: 14px; margin: 0 0 4px; }

/* ============================================================
   Hero scene
   ============================================================ */
.scene.hero { flex-direction: column; gap: 24px; position: relative; }

#desktop-icons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  max-width: 560px;
}
.desktop-icon {
  width: 84px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,.8);
}
.desktop-icon img { width: 40px; height: 40px; display: block; margin: 0 auto 3px; image-rendering: pixelated; }
.desktop-icon span { font-size: 12px; line-height: 1.2; }
.desktop-icon:hover,
.desktop-icon:focus { outline: none; border-color: rgba(255,255,255,.5); background: rgba(11,71,201,.35); }

.hero-card {
  opacity: 0;
  transform: translateY(40px) scale(.95);
  animation: heroIn .7s ease .2s forwards;
  width: 320px;
  max-width: calc(100vw - 24px);
  box-shadow: 4px 4px 16px rgba(0,0,0,.45);
  text-align: center;
}
.hero-card .window-body { padding: 18px 16px 20px; }
.hero-avatar {
  width: 96px; height: 96px;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #808080;
  margin-bottom: 8px;
}
.hero-card h1 { font-size: 24px; margin: 4px 0 0; }
.hero-hint { color: #444; font-size: 12px; margin-top: 14px !important; }
.hero-hint .arrow { display: inline-block; animation: bob 1.6s ease-in-out 3; }
@keyframes heroIn { to { opacity: 1; transform: none; } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ============================================================
   Content styles
   ============================================================ */
.about-hero {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid #c0c0c0;
}
.about-hero .avatar {
  width: 72px; height: 72px; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #808080; flex: none;
}
.job-title { color: var(--start-blue); font-weight: bold; margin: 2px 0 0; }

.job { margin-bottom: 6px; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.role { color: #444; margin: 2px 0 !important; }
.period { color: #555; font-style: italic; white-space: nowrap; }
.tags { color: #0a5; font-size: 12px; margin: 4px 0 8px !important; }
.job ul { margin: 4px 0 0; padding-left: 18px; }
.job li { margin-bottom: 5px; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.project {
  padding: 10px; background: #fff; text-align: center;
  cursor: pointer; transition: background .1s;
}
.project:hover { background: #eef4ff; }
.project:focus { outline: 1px dotted #0a246a; outline-offset: -3px; }
.project-icon { font-size: 30px; margin-bottom: 4px; }
.project p { font-size: 12px; }
.project .tags { margin-top: 6px !important; }

.project-banner {
  font-size: 48px; text-align: center; padding: 14px 0; margin-bottom: 8px;
  background: linear-gradient(to bottom, #e8efff, #fff); border: 1px solid #c0c9e0;
}
/* Real key-art banner image — keeps its natural aspect ratio */
.project-banner-img {
  display: block;
  width: 100%;
  height: auto;            /* height follows the image's aspect ratio */
  margin-bottom: 8px;
  border: 1px solid #808080;
  box-shadow: inset 0 0 0 1px #fff;
  background: #000;
}
a:has(> .project-banner-img) { display: block; cursor: pointer; }
a:has(> .project-banner-img):hover .project-banner-img { filter: brightness(1.08); }

.skill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; padding: 0; }
.skill-list li { background: #ece9d8; border: 1px solid #aca899; padding: 4px 10px; font-size: 12px; border-radius: 2px; }

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px dotted #ccc; }
.contact-list img { width: 24px; height: 24px; image-rendering: pixelated; }
.contact-list a { color: var(--start-blue); }

/* ============================================================
   Taskbar
   ============================================================ */
#taskbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--taskbar-height);
  display: flex; align-items: stretch;
  background: linear-gradient(to bottom, #3168d5 0%, #4993e8 8%, #2861d8 12%, #2b62d9 88%, #1941a5 100%);
  border-top: 1px solid #1c3fa0;
  z-index: 1000;
}
#start-button {
  display: flex; align-items: center; gap: 5px; height: 100%;
  padding: 0 22px 0 8px; border: none; border-radius: 0 9px 9px 0;
  background: linear-gradient(to bottom, #5eb14e 0%, #54a83f 10%, #3c8f2c 50%, #348526 90%, #2e7a22 100%);
  color: #fff; font-style: italic; font-weight: bold; font-size: 17px;
  text-shadow: 1px 1px 1px rgba(0,0,0,.4); cursor: pointer; box-shadow: none; min-height: auto;
}
#start-button:active, #start-button.active { background: linear-gradient(to bottom, #348526 0%, #3c8f2c 50%, #5eb14e 100%); }
#start-button img { width: 20px; height: 20px; }
#start-button:focus { outline: none; }

#taskbar-items { flex: 1 1 auto; display: flex; align-items: center; gap: 4px; padding: 3px 6px; overflow: hidden; }
.taskbar-item {
  display: flex; align-items: center; gap: 6px; height: 26px;
  min-width: 150px; max-width: 220px; padding: 0 10px;
  border: 1px solid #1f50b5; border-radius: 2px;
  background: linear-gradient(to bottom, #1f50b5, #2f6ad9); color: #fff; font-size: 12px;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.taskbar-item img { width: 16px; height: 16px; flex: none; }

#clock {
  display: flex; align-items: center; padding: 0 14px; color: #fff; font-size: 12px;
  background: linear-gradient(to bottom, #1287e2 0%, #14a7eb 8%, #1190e4 50%, #1577d6 100%);
  border-left: 1px solid #1c51c8; box-shadow: inset 1px 0 1px rgba(255,255,255,.25); white-space: nowrap;
}

/* ============================================================
   Start menu
   ============================================================ */
#start-menu {
  position: fixed; bottom: var(--taskbar-height); left: 0; width: 300px;
  background: #fff; border: 1px solid #0831d9; border-bottom: none; border-radius: 8px 8px 0 0;
  box-shadow: 3px 0 12px rgba(0,0,0,.5); z-index: 1001; overflow: hidden;
}
#start-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff;
  font-weight: bold; font-size: 15px;
  background: linear-gradient(to bottom, #1c51c8, #2360da 50%, #1c51c8);
  border-bottom: 2px solid #ff8c00; text-shadow: 1px 1px 2px rgba(0,0,0,.5);
}
#start-header img { width: 36px; height: 36px; object-fit: cover; border: 1px solid rgba(255,255,255,.5); border-radius: 3px; }
#start-body { padding: 6px; }
.start-list { list-style: none; margin: 0; padding: 0; }
.start-list li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 13px; cursor: pointer; border-radius: 2px; }
.start-list li img { width: 24px; height: 24px; image-rendering: pixelated; }
.start-list li:hover { background: var(--start-blue); color: #fff; }
#start-body hr { border: none; border-top: 1px solid #aca899; margin: 5px 2px; }

/* ============================================================
   Shutdown overlay
   ============================================================ */
#shutdown-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(to bottom, #4a6cc8, #34509e);
  color: #fff; display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 18px; z-index: 2000; text-align: center; font-size: 20px;
}
#shutdown-overlay button { font-size: 14px; padding: 6px 18px; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 720px) {
  .scene { padding: 3.5vh 10px; min-height: 0; }
  .scene.hero { min-height: 100svh; }
  #scene-about { padding-top: 12vh; }
  #scene-contact { padding-bottom: calc(var(--taskbar-height) + 12vh); }
  .xp-window { width: 100%; max-height: 66svh; transform: scale(.85); }
  .xp-window.in-view { transform: scale(.9); }
  .xp-window.active { transform: none; }
  .desktop-icon { width: 76px; }
  #start-menu { width: 86vw; }
  .taskbar-item { min-width: 0; flex: 1 1 auto; }
  #clock { padding: 0 8px; font-size: 11px; }
  .job-head { flex-direction: column; }
}
@media (max-width: 420px) {
  #start-button { padding-right: 14px; font-size: 15px; }
  .taskbar-item span { overflow: hidden; text-overflow: ellipsis; }
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  .xp-window { transition: filter .3s ease; opacity: 1; transform: none !important; animation: none !important; }
  .hero-card { animation: none; opacity: 1; transform: none; }
}
