/* ===== Windows 98 aesthetic — hand rolled, no external assets ===== */

:root{
  --w98-face:#c0c0c0;
  --w98-face-dark:#808080;
  --w98-face-darker:#404040;
  --w98-face-light:#dfdfdf;
  --w98-face-lighter:#ffffff;
  --w98-titlebar:#000080;
  --w98-titlebar-2:#1084d0;
  --w98-titlebar-text:#ffffff;
  --w98-desktop:#008080;
  --w98-text:#000000;
  --w98-link:#0000ee;
}

*{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
  min-height:100%;
  background:var(--w98-desktop);
  color:var(--w98-text);
  font-family:"Pixelated MS Sans Serif","MS Sans Serif",Tahoma,Geneva,Arial,sans-serif;
  font-size:13px;
  -webkit-font-smoothing:none;
}

body{
  padding:24px 16px 70px;
  min-height:100vh;
}

a{ color:var(--w98-link); }
a:visited{ color:#551a8b; }

/* generic bevel helpers */
.raised{
  border-top:2px solid var(--w98-face-lighter);
  border-left:2px solid var(--w98-face-lighter);
  border-right:2px solid var(--w98-face-darker);
  border-bottom:2px solid var(--w98-face-darker);
  box-shadow: inset 1px 1px 0 var(--w98-face-light), inset -1px -1px 0 var(--w98-face-dark);
}
.sunken{
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
  box-shadow: inset 1px 1px 0 var(--w98-face-dark), inset -1px -1px 0 var(--w98-face-light);
}

/* window chrome */
.window{
  position:relative;
  z-index:1;
  background:var(--w98-face);
  max-width:760px;
  margin:0 auto 20px;
}
.window.raised{ }

.window.maximized{
  position:fixed;
  inset:12px 12px 46px 12px;
  max-width:none;
  margin:0;
  z-index:150;
  display:flex;
  flex-direction:column;
  box-shadow:2px 2px 12px rgba(0,0,0,0.4);
}
.window.maximized .window-body{
  flex:1;
  overflow-y:auto;
}

.title-bar{
  background:linear-gradient(90deg,var(--w98-titlebar),var(--w98-titlebar-2));
  color:var(--w98-titlebar-text);
  font-weight:bold;
  padding:3px 3px 3px 6px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  user-select:none;
}
.title-bar-text{
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.icon-inline{
  width:16px;
  height:16px;
  image-rendering:pixelated;
  vertical-align:middle;
  flex-shrink:0;
}
.btn98,.start-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.title-bar-controls{
  display:flex;
  gap:2px;
}
.title-bar-controls button{
  width:16px;
  height:14px;
  background:var(--w98-face);
  border-top:1px solid var(--w98-face-lighter);
  border-left:1px solid var(--w98-face-lighter);
  border-right:1px solid var(--w98-face-darker);
  border-bottom:1px solid var(--w98-face-darker);
  font-size:10px;
  line-height:1;
  padding:0;
  cursor:pointer;
  color:#000;
}
.title-bar-controls button:active{
  border-top:1px solid var(--w98-face-darker);
  border-left:1px solid var(--w98-face-darker);
  border-right:1px solid var(--w98-face-lighter);
  border-bottom:1px solid var(--w98-face-lighter);
}
/* The "_" glyph sits on the text baseline, hard against the bottom bevel, so at
   1x it visually disappears. Draw the minimise bar instead - the aria-label on
   the button still carries the meaning. */
.title-bar-controls button[data-action="minimize"]{
  position:relative;
  font-size:0;
}
.title-bar-controls button[data-action="minimize"]::after{
  content:"";
  position:absolute;
  left:3px;
  right:3px;
  bottom:3px;
  height:2px;
  background:#000;
}
.title-bar-controls button[data-action="minimize"]:active::after{
  left:4px;
  right:2px;
  bottom:2px;
}

.window-body{
  padding:12px;
}

/* buttons */
.btn98{
  background:var(--w98-face);
  border-top:2px solid var(--w98-face-lighter);
  border-left:2px solid var(--w98-face-lighter);
  border-right:2px solid var(--w98-face-darker);
  border-bottom:2px solid var(--w98-face-darker);
  padding:5px 14px;
  font-family:inherit;
  font-size:13px;
  cursor:pointer;
  color:var(--w98-text);
}
.btn98:active{
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
  padding:6px 13px 4px 15px;
}
.btn98:focus{ outline:1px dotted #000; outline-offset:-4px; }

/* sunken field / panel */
.field98{
  background:#fff;
  padding:8px;
}

/* section headers within a window */
h1,h2,h3{ margin:0 0 8px; font-weight:bold; }
h1{ font-size:16px; }
h2{ font-size:14px; }
h3{ font-size:13px; }
p{ margin:0 0 8px; line-height:1.5; }
ul{ margin:0 0 8px; padding-left:20px; }

hr.divider{
  border:none;
  border-top:1px solid var(--w98-face-darker);
  border-bottom:1px solid var(--w98-face-lighter);
  margin:10px 0;
}

/* ===== header / about ===== */
.profile{
  display:flex;
  gap:16px;
  align-items:flex-start;
}
/* ===== face banner ===================================================
   The face lives in its own window. On a wide screen it is pinned to the
   right of the page like a banner ad; below 1200px there isn't room beside
   the 760px content column, so it falls back into normal flow at the top. */
.face-window{
  width:184px;
  max-width:100%;
  margin:0 auto 20px;
}
@media (min-width:1200px){
  .face-window{
    position:fixed;
    top:24px;
    right:24px;
    margin:0;
    z-index:60;
  }
}
.face-hint{
  margin:6px 0 0;
  text-align:center;
  font-size:11px;
  color:#404040;
}
.quest-btn{
  display:block;
  width:100%;
  margin-top:8px;
  justify-content:center;
}
.quest-btn:disabled{
  color:#808080;
  text-shadow:1px 1px 0 #fff;
  cursor:default;
}
.quest-text{
  margin:8px 0 0;
  min-height:2.6em;
  padding:5px 6px;
  background:#000;
  color:#00ff66;
  font-size:11px;
  line-height:1.35;
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
}

/* ===== the chipa ===== */
.chipa{
  position:absolute;
  width:46px;
  height:46px;
  z-index:80;
  cursor:grab;
  user-select:none;
  -webkit-user-drag:none;
  touch-action:none;
  image-rendering:auto;
  filter:drop-shadow(2px 2px 0 rgba(0,0,0,0.35));
  transition:opacity 0.15s linear;
}
.chipa.held{
  cursor:grabbing;
  transform:scale(1.12) rotate(-6deg);
  filter:drop-shadow(4px 5px 0 rgba(0,0,0,0.35));
}
.chipa.eaten{
  opacity:0;
  pointer-events:none;
}

/* Layered face rig: head + sliding jaw + angry expression, all the same
   390x608 canvas. The container keeps that aspect ratio so the jaw's
   percentage offsets map exactly onto source pixels. */
.face-rig{
  position:relative;
  width:100%;
  aspect-ratio:390 / 608;
  cursor:pointer;
  user-select:none;
}
.face-layer{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  image-rendering:auto;
  -webkit-user-drag:none;
}
/* display:block above would defeat the [hidden] attribute, so restore it */
.face-layer[hidden]{ display:none; }
.face-jaw{
  /* slides straight down; the distance is set from js/face.js */
  will-change:transform;
}

/* Recoil when the face is clicked. The kick direction, distance, rotation and
   duration are randomised per hit in js/hitme.js, so spam-clicking doesn't
   replay one identical canned animation. */
.face-rig.hit{
  animation:photo-hit var(--hit-dur,0.4s) ease-out;
}
@keyframes photo-hit{
  0%   { transform:translate(0,0) rotate(0deg) scale(1); }
  15%  { transform:translate(var(--hit-x,5px),var(--hit-y,-3px))
                   rotate(var(--hit-rot,3deg)) scale(var(--hit-scale,1.06)); }
  32%  { transform:translate(calc(var(--hit-x,5px) * -0.62),calc(var(--hit-y,-3px) * -0.5))
                   rotate(calc(var(--hit-rot,3deg) * -0.7)) scale(1.03); }
  52%  { transform:translate(calc(var(--hit-x,5px) * 0.4),calc(var(--hit-y,-3px) * 0.28))
                   rotate(calc(var(--hit-rot,3deg) * 0.42)) scale(1.02); }
  74%  { transform:translate(calc(var(--hit-x,5px) * -0.18),calc(var(--hit-y,-3px) * -0.12))
                   rotate(calc(var(--hit-rot,3deg) * -0.18)) scale(1.005); }
  100% { transform:translate(0,0) rotate(0deg) scale(1); }
}

.hit-particle{
  position:fixed;
  z-index:500;
  pointer-events:none;
  border:1px solid rgba(0,0,0,0.55);
  animation:hit-particle-fly 0.6s ease-out forwards;
}
@keyframes hit-particle-fly{
  from{
    transform:translate(-50%,-50%) translate(0,0) scale(1);
    opacity:1;
  }
  to{
    transform:translate(-50%,-50%) translate(var(--dx),var(--dy)) scale(0.3);
    opacity:0;
  }
}
@media (prefers-reduced-motion:reduce){
  .face-rig.hit{ animation:none; }
  .hit-particle{ display:none; }
}

/* ===== decorative desktop trash (bottom right, behind the windows) ===== */
.desktop-trash{
  position:fixed;
  right:18px;
  bottom:46px;
  width:76px;
  text-align:center;
  color:#fff;
  font-size:11px;
  text-shadow:1px 1px 0 rgba(0,0,0,0.7);
  pointer-events:none;
  user-select:none;
  z-index:0;
}
.desktop-trash img{
  display:block;
  width:48px;
  height:48px;
  margin:0 auto 3px;
  image-rendering:pixelated;
}

.profile-info h1{
  font-size:20px;
}
.profile-info .tagline{
  color:#000080;
  font-weight:bold;
  margin-bottom:6px;
}
.profile-links{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.profile-links a.btn98{
  text-decoration:none;
}

/* ===== project list (icon grid, desktop-style) ===== */
.project-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(96px,1fr));
  gap:14px;
  padding:6px;
}
.project-icon{
  background:transparent;
  border:none;
  padding:8px 4px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  cursor:pointer;
  color:#fff;
  font-family:inherit;
  font-size:12px;
  text-align:center;
}
.project-grid.on-face .project-icon{ color:#000; }
.project-icon .icon-glyph{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--w98-face);
  border-top:2px solid var(--w98-face-lighter);
  border-left:2px solid var(--w98-face-lighter);
  border-right:2px solid var(--w98-face-darker);
  border-bottom:2px solid var(--w98-face-darker);
}
.project-icon:hover .icon-glyph,
.project-icon:focus .icon-glyph{
  background:#d4d0c8;
}
.icon-glyph img{
  width:32px;
  height:32px;
  image-rendering:pixelated;
}
.project-icon .icon-label{
  padding:1px 3px;
}
.project-icon:focus .icon-label,
.project-icon:hover .icon-label{
  background:#000080;
  color:#fff;
}

/* ===== modal popup ===== */
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.35);
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:40px 16px;
  overflow-y:auto;
  z-index:100;
}
.overlay[hidden]{ display:none; }
.modal-window{
  width:min(560px,100%);
  margin-top:20px;
}
.modal-body{
  max-height:70vh;
  overflow-y:auto;
}
.modal-gallery{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.modal-gallery img{
  width:120px;
  height:80px;
  object-fit:cover;
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
}
.tag-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:8px 0;
}
.tag{
  background:var(--w98-face-light);
  border-top:1px solid var(--w98-face-lighter);
  border-left:1px solid var(--w98-face-lighter);
  border-right:1px solid var(--w98-face-darker);
  border-bottom:1px solid var(--w98-face-darker);
  padding:2px 6px;
  font-size:11px;
}
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:10px;
}

/* ===== blog page ===== */
.blog-hero-gallery{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.blog-hero-gallery img{
  width:100%;
  max-width:340px;
  height:auto;
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
}
.breadcrumb{
  margin-bottom:10px;
}

/* ===== repo list ===== */
.repo-list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:6px;
}
.repo-item{
  background:var(--w98-face-light);
  border-top:1px solid var(--w98-face-lighter);
  border-left:1px solid var(--w98-face-lighter);
  border-right:1px solid var(--w98-face-dark);
  border-bottom:1px solid var(--w98-face-dark);
  padding:6px 8px;
}
.repo-item a{
  font-weight:bold;
  overflow-wrap:anywhere;
}
.repo-desc{
  margin-top:2px;
  color:#333;
  line-height:1.4;
}

/* ===== contact panel ===== */
.contact-window{
  max-width:760px;
}
.contact-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:10px;
}
.contact-item{
  background:var(--w98-face-light);
  padding:6px 8px;
}
.contact-item strong{ display:block; font-size:11px; color:#000080; }

/* ===== taskbar ===== */
.taskbar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  height:34px;
  background:var(--w98-face);
  border-top:2px solid var(--w98-face-lighter);
  display:flex;
  align-items:center;
  padding:2px 4px;
  gap:6px;
  z-index:200;
}
.start-btn{
  font-weight:bold;
  display:flex;
  align-items:center;
  gap:4px;
  text-decoration:none;
  color:var(--w98-text);
  flex-shrink:0;
}
.taskbar-windows{
  display:flex;
  align-items:center;
  gap:4px;
  flex:1;
  min-width:0;
  overflow-x:auto;
  height:100%;
}
.taskbar-btn{
  flex:0 1 150px;
  min-width:70px;
  max-width:150px;
  padding:3px 8px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  justify-content:flex-start;
}
.taskbar-btn span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.taskbar-btn.active{
  border-top:2px solid var(--w98-face-darker);
  border-left:2px solid var(--w98-face-darker);
  border-right:2px solid var(--w98-face-lighter);
  border-bottom:2px solid var(--w98-face-lighter);
}
.taskbar-clock{
  flex-shrink:0;
  background:var(--w98-face);
  border-top:1px solid var(--w98-face-darker);
  border-left:1px solid var(--w98-face-darker);
  border-right:1px solid var(--w98-face-lighter);
  border-bottom:1px solid var(--w98-face-lighter);
  padding:4px 10px;
  font-size:12px;
}
.version-badge{
  flex-shrink:0;
  font-size:11px;
  text-decoration:none;
  color:var(--w98-text);
  padding:3px 8px;
}
.lang-btn{
  flex-shrink:0;
  font-size:11px;
  padding:3px 8px;
}

@media (max-width:600px){
  /* Reclaim horizontal space and stop the page being three screens tall */
  body{ padding:10px 8px 46px; }
  .window{ margin:0 auto 12px; }
  .window-body{ padding:10px; }

  /* Photo beside the text, left-aligned - centred paragraphs read badly and
     eat a lot of vertical space on a phone. */
  .profile{ flex-direction:row; align-items:flex-start; text-align:left; gap:10px; }
  .face-window{ width:150px; }
  .desktop-trash{ right:10px; bottom:40px; width:64px; font-size:10px; }
  .desktop-trash img{ width:38px; height:38px; }
  .profile-info h1{ font-size:17px; }
  .profile-info .tagline{ font-size:12px; }
  p{ margin:0 0 6px; line-height:1.45; }
  .profile-links{ gap:5px; }

  /* Long URLs must wrap instead of stretching the layout */
  .contact-grid{ grid-template-columns:1fr; gap:6px; }
  .contact-item{ overflow-wrap:anywhere; }

  .project-grid{ gap:10px; padding:2px; }
  .modal-window{ margin-top:6px; }
  .overlay{ padding:12px 8px; }

  /* Taskbar is too crowded at phone widths for full text labels - go icon-only */
  .taskbar{ gap:4px; padding:2px; height:30px; }
  .start-label{ display:none; }
  .start-btn{ padding:4px 7px; }
  .taskbar-btn{ min-width:32px; max-width:32px; padding:4px; justify-content:center; }
  .taskbar-btn .taskbar-label{ display:none; }
  .taskbar-clock{ padding:3px 5px; font-size:11px; }
  .version-badge{ padding:3px 5px; font-size:10px; }
  .lang-btn{ padding:3px 5px; font-size:10px; }
}
