:root{
  --sky: #c8ccff;           /* purple accent */
  --sky-deep: #b3b8fb;
  --paper: #ffffff;
  --ink: #1a1830;
  --ink-2: #3d3b58;
  --muted: #6c6a88;
  --accent: #5b5bf0;
  --tint: #ececff;
  --line: 2px solid var(--ink);
  --scene-opacity: 1;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark){
  :root{
    --sky: #1f1d3d;
    --sky-deep: #17162e;
    --paper: #14132a;
    --ink: #e9e8ff;
    --ink-2: #c4c3e6;
    --muted: #9391b8;
    --accent: #9a9dff;
    --tint: #2a2856;
    --scene-opacity: .14;
  }
}

*{ box-sizing:border-box; }

html{ scroll-behavior: smooth; scroll-padding-top: 72px; }

body{
  margin:0;
  background: var(--sky-deep);
  color: var(--ink);
  font-family: "Lexend", system-ui, sans-serif;
  font-weight: 350;
  font-size: 16px;
  line-height: 1.55;
}

a{
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover{ color: var(--ink); }

:focus-visible{
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

.muted{ color: var(--muted); }

/* --- Taskbar --- */
.taskbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: var(--line);
}

.taskbar-inner{
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 16px;
  display:flex;
  align-items:center;
  gap: 12px;
}

.start, .tasks a{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 4px 12px;
  border: var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 15px;
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .08s ease, box-shadow .08s ease;
}

.start{ background: var(--tint); font-weight: 700; }
.start img{ width: 18px; height: 18px; image-rendering: pixelated; }

.start:hover, .tasks a:hover{
  color: var(--ink);
  background: var(--tint);
}

.start:active, .tasks a:active{
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.tasks{
  display:flex;
  gap: 8px;
  margin-left: auto;
  overflow-x: auto;
}

@media (max-width: 560px){
  .taskbar-inner{ gap: 8px; padding: 8px 10px; }
  .tasks{ gap: 6px; }
  .tasks a{ padding: 3px 7px; font-size: 12px; box-shadow: 1px 1px 0 var(--ink); }
  .start{ padding: 4px 6px; }
  .start span{ display:none; }
}

/* --- Desktop + windows --- */
.desktop{
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 8px;
  display:flex;
  flex-direction:column;
  gap: 28px;
}

.win{
  border: var(--line);
  border-radius: 12px;
  background: var(--sky);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* pixel scenery sits behind window content */
.win::after{
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: var(--scene-opacity);
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}

.scene-clouds::after{
  background-image: url("pixel/clouds.svg");
  background-size: max(100%, 1200px) auto;
  background-position: center bottom;
}

.scene-clouds-lite::after{
  background-image: url("pixel/clouds.svg");
  background-size: max(100%, 1200px) auto;
  background-position: center top;
  opacity: calc(var(--scene-opacity) * .5);
}

.scene-mountains::after{
  background-image: url("pixel/mountains.svg");
  background-size: max(100%, 1200px) auto;
  background-position: center bottom;
}

.scene-sea::after{
  background-image: url("pixel/sea.svg");
  background-size: max(100%, 1200px) auto;
  background-position: center bottom;
}

.win-bar{
  margin: 12px 12px 0;
  padding: 6px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  background: var(--paper);
  border: var(--line);
  border-radius: 8px;
}

.win-title{
  margin: 0;
  font-family: var(--pixel);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.win-icon{
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
}

.win-body{
  padding: 24px;
}

@media (max-width: 560px){
  .win-body{ padding: 18px 14px; }
  .win-title{ font-size: 16px; }
}

/* --- Panes (inner windows) --- */
.pane{
  background: var(--paper);
  border: var(--line);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  min-width: 0;
}

.pane-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 4px 10px;
  border-bottom: var(--line);
}

.pane-title{
  font-size: 16px;
  font-weight: 400;
}

/* the two little window buttons */
.dots{
  flex: 0 0 auto;
  display:inline-flex;
  gap: 4px;
}
.dots::before, .dots::after{
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.pane-body{ padding: 14px 16px 16px; }
.pane-body p{ margin: 0 0 10px; }
.pane-body p:last-child{ margin-bottom: 0; }

/* --- Hero --- */
.hero{
  display:grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 28px;
  align-items:start;
}

.hero-intro{
  display:flex;
  align-items:flex-start;
  gap: 22px;
  flex-wrap: wrap;
}

.digital-me{ flex: 0 0 auto; }
.digital-me .pane-body{ padding: 10px; }

.avatar{
  display:block;
  width: 168px;
  height: 168px;
  object-fit: cover;
}

.avatar-pixel{ image-rendering: pixelated; }

/* hover the portrait to see the real photo */
.avatar-photo{ display:none; }
.digital-me:hover .avatar-pixel{ display:none; }
.digital-me:hover .avatar-photo{ display:block; }

.bubble-speech{
  position: relative;
  margin: 18px 0 0;
  padding: 12px 18px;
  background: var(--paper);
  border: var(--line);
  border-radius: 16px;
  font-size: 17px;
  font-weight: 400;
}

.bubble-speech::before{
  content: "";
  position: absolute;
  left: -11px;
  top: 16px;
  width: 16px;
  height: 16px;
  background: var(--paper);
  border-left: var(--line);
  border-bottom: var(--line);
  transform: rotate(45deg);
}

.name{
  margin: 30px 0 0;
  font-family: var(--pixel);
  font-weight: 600;
  font-size: clamp(42px, 6.5vw, 76px);
  line-height: 1;
  letter-spacing: 1px;
  color: var(--paper);
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    5px 5px 0 var(--ink);
}

.tagline{
  margin: 14px 0 0;
  display:inline-block;
  padding: 4px 12px;
  background: var(--paper);
  border: var(--line);
  border-radius: 6px;
  max-width: 100%;
  font-size: clamp(14px, 1.6vw, 17px);
  font-weight: 400;
}

.hero-actions{
  margin-top: 18px;
  display:flex;
  flex-wrap:wrap;
  gap: 12px;
}

.btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 16px;
  border: var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 16px;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s ease, box-shadow .08s ease;
}

.btn:hover{ background: var(--tint); color: var(--ink); }
.btn:active{ transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

@media (max-width: 980px){
  .hero{ grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px){
  .avatar{ width: 128px; height: 128px; }
  .bubble-speech{ margin-top: 0; }
  .bubble-speech::before{ display:none; }
}

/* --- Installed programs --- */
.programs{
  display:grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  grid-template-areas:
    "software about"
    "software education";
  gap: 24px;
  align-items:start;
  padding-bottom: 60px;   /* let the mountains show */
}

.software{ grid-area: software; }
.about{ grid-area: about; }
.education{ grid-area: education; }

.skill-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
}

.skill-list li{
  display:flex;
  align-items:center;
  gap: 8px;
}

/* little pixel "installed" checkbox */
.skill-list li::before{
  content: "✓";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  display:grid;
  place-items:center;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.edu + .edu{ margin-top: 12px; }
.edu strong{ font-weight: 500; }
.edu p{ color: var(--ink-2); }

@media (max-width: 820px){
  .programs{
    grid-template-columns: 1fr;
    grid-template-areas: "about" "software" "education";
    padding-bottom: 40px;
  }
}

/* --- Experience --- */
.stack{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items:start;
}

@media (max-width: 820px){
  .stack{ grid-template-columns: 1fr; }
}

.role{
  font-weight: 500;
  font-size: 17px;
}

.date{
  display:inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--tint);
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--ink-2);
}

.pane ul{
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 15px;
}

.pane li{ margin: 6px 0; }
.pane li::marker{ content: "> "; font-family: var(--pixel); color: var(--accent); }

/* --- Projects --- */
.proj-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

@media (max-width: 520px){
  .proj-grid{ grid-template-columns: 1fr; }
}

.proj{
  display:flex;
  flex-direction:column;
  transition: transform .12s ease, box-shadow .12s ease;
}

.proj:hover{
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.proj .pane-body{
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.proj-media{
  aspect-ratio: 16 / 10;
  overflow:hidden;
  border: var(--line);
  border-radius: 4px;
  background: var(--tint);
  margin-bottom: 4px;
}

.proj-media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

.proj-title{
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.proj-text{
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}

.proj-text a{ display:inline-block; margin-top: 4px; }

/* --- Connect --- */
.connect{
  position: relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 28px;
  padding: 24px 0 90px;
}

.connect-head{
  margin: 0;
  text-align: center;
  font-family: var(--pixel);
  font-weight: 600;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.25;
  color: var(--paper);
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    4px 4px 0 var(--ink);
}

.connect-head span{ font-size: 1.25em; }

.spark{
  position: absolute;
  width: 27px;
  height: 27px;
  image-rendering: pixelated;
  animation: twinkle 2.4s steps(2) infinite;
}
.s1{ left: 8%; top: 18%; }
.s2{ right: 10%; top: 8%; animation-delay: .8s; }
.s3{ right: 18%; top: 44%; width: 18px; height: 18px; animation-delay: 1.6s; }

@keyframes twinkle{
  50%{ opacity: .25; }
}

.contact-pane{ width: min(100%, 520px); }

.contact{
  margin: 0;
  display:grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
}

.contact dt{ font-family: var(--pixel); }
.contact dd{ margin: 0; overflow-wrap: anywhere; }

@media (max-width: 560px){
  .spark{ display:none; }
  .contact{ grid-template-columns: 1fr; gap: 0; }
  .contact dd{ margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .spark{ animation: none; }
}

/* --- Footer --- */
.site-footer{
  padding: 24px 16px 32px;
  text-align: center;
  font-family: var(--pixel);
  font-size: 15px;
  color: var(--ink-2);
}

.site-footer .heart{
  color: #e0457b;
  padding: 0 4px;
}

/* --- Chat panel --- */
.chat-panel{
  position: relative;
  box-shadow: 6px 6px 0 var(--ink);
}

.chat-title-row{ background: var(--tint); border-radius: 6px 6px 0 0; }

.chat-panel.collapsed .chat-title-row{
  border-bottom-color: transparent;
  border-radius: 6px;
}

/* Minimize button */
.chat-toggle{
  flex: 0 0 auto;
  width: 26px;
  height: 22px;
  display:grid;
  place-items:center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.chat-toggle:hover{ background: var(--sky); }

.chat-toggle .chev{
  display:inline-block;
  font-size: 13px;
  line-height: 1;
  transition: transform .18s ease;
}

/* Screen-reader only helper */
.sr-only{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0);
  white-space:nowrap; border:0;
}

/* Animated collapse */
.chatbox{
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 640px;
  opacity: 1;
  transform: translateY(0);
  transform-origin: top;
  transition: max-height .22s ease, opacity .18s ease, transform .18s ease, padding .18s ease;
}

.chat-panel.collapsed .chatbox{
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  pointer-events: none;
}

.chat-panel.collapsed .chat-toggle .chev{
  transform: rotate(-90deg);
}

.chatlog{
  min-height: 240px;
  max-height: 46vh;
  overflow: auto;
  padding: 4px 2px;
}

/* Message bubbles */
.msg{ margin: 10px 0; display:flex; }

.bubble{
  max-width: 86%;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bot .bubble{
  background: var(--paper);
  border-bottom-left-radius: 2px;
}

.user .bubble{
  margin-left:auto;
  background: var(--tint);
  border-bottom-right-radius: 2px;
}

.chatform{
  display:flex;
  gap: 8px;
  align-items:center;
  padding: 4px 4px 4px 12px;
  border: var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.chatform:focus-within{ box-shadow: 0 0 0 3px var(--sky); }

.prompt{
  font-family: var(--pixel);
  color: var(--accent);
}

.chatform input{
  flex: 1;
  min-width: 0;
  padding: 8px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.chatform input::placeholder{ color: var(--muted); }

.chatform button{
  padding: 5px 14px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--tint);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 15px;
  cursor:pointer;
}

.chatform button:hover{ background: var(--sky); }

.chat-note{
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
