/* ============================================================
   Z // OS — retro-desktop personal site
   Win9x-flavored chrome built from scratch (no framework).
   ============================================================ */

:root {
  /* Surfaces */
  --face: #c0c0c0;
  --face-light: #dfdfdf;
  --face-dark: #808080;
  --face-darker: #000000;
  --highlight: #ffffff;

  /* Title bars */
  --title-active-a: #000080;
  --title-active-b: #1084d0;
  --title-inactive-a: #808080;
  --title-inactive-b: #b5b5b5;
  --title-text: #ffffff;

  /* Desktop */
  --desktop: #008080; /* classic teal */
  --selection: rgba(0, 0, 128, 0.55);

  /* Typography */
  --font-sys: "Pixelated MS Sans Serif", "MS Sans Serif",
    "Microsoft Sans Serif", Tahoma, "Geneva", sans-serif;
  --font-mono: "Lucida Console", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sys);
  font-size: 12px;
  color: #000;
  background: var(--desktop);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- Desktop ---------------------------------------- */
#desktop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30px; /* taskbar height */
  overflow: hidden;
}

#icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  padding: 10px;
  height: 100%;
}

/* Top-right "games corner" — game icons live here. */
#icons-right {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 80px;
  padding: 6px 4px;
  background: transparent;
  border: 1px dotted transparent;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}

.desktop-icon:focus {
  outline: none;
  border: 1px dotted #fff;
}
.desktop-icon.selected,
.desktop-icon:focus-visible {
  border: 1px dotted #fff;
}
.desktop-icon.selected .icon-label,
.desktop-icon:focus-visible .icon-label {
  background: var(--selection);
  outline: 1px dotted #fff;
}

.desktop-icon .icon-img {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.35));
}
.desktop-icon .icon-img svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: crispEdges;
}

.desktop-icon .icon-label {
  padding: 1px 3px;
  text-shadow: 1px 1px 0 #000;
}

/* ---------- Bevels (the heart of Win9x) -------------------- */
.bevel-out {
  border-top: 1px solid var(--highlight);
  border-left: 1px solid var(--highlight);
  border-right: 1px solid var(--face-darker);
  border-bottom: 1px solid var(--face-darker);
  box-shadow: inset -1px -1px 0 var(--face-dark),
    inset 1px 1px 0 var(--face-light);
}
.bevel-in {
  border-top: 1px solid var(--face-darker);
  border-left: 1px solid var(--face-darker);
  border-right: 1px solid var(--highlight);
  border-bottom: 1px solid var(--highlight);
  box-shadow: inset 1px 1px 0 var(--face-dark),
    inset -1px -1px 0 var(--face-light);
}

/* ---------- Taskbar ---------------------------------------- */
#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  background: var(--face);
  border-top: 1px solid var(--highlight);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 3px;
  z-index: 10000;
}

#start-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px 0 4px;
  background: var(--face);
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}
#start-btn:focus {
  outline: 1px dotted #000;
  outline-offset: -4px;
}
#start-btn.pressed {
  /* invert bevel — handled by toggling class */
}

.start-logo {
  display: inline-block;
  width: 16px;
  height: 16px;
  background:
    linear-gradient(#ff3b30, #ff3b30) 0 0 / 6px 6px no-repeat,
    linear-gradient(#34c759, #34c759) 8px 0 / 6px 6px no-repeat,
    linear-gradient(#007aff, #007aff) 0 8px / 6px 6px no-repeat,
    linear-gradient(#ffcc00, #ffcc00) 8px 8px / 6px 6px no-repeat;
  transform: skewX(-12deg);
}

.taskbar-divider {
  width: 2px;
  height: 22px;
  background: var(--face-dark);
  border-right: 1px solid var(--highlight);
  margin: 0 2px;
}

#taskbar-items {
  display: flex;
  flex: 1;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.taskbar-item {
  height: 24px;
  min-width: 130px;
  max-width: 180px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--face);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.taskbar-item .ti-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.taskbar-item .ti-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.taskbar-item .ti-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.taskbar-item.active {
  font-weight: bold;
  background: linear-gradient(
    45deg,
    var(--face) 25%,
    var(--face-light) 25%,
    var(--face-light) 50%,
    var(--face) 50%,
    var(--face) 75%,
    var(--face-light) 75%
  );
  background-size: 4px 4px;
}

#taskbar-tray {
  height: 24px;
  min-width: 70px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#taskbar-clock {
  font-family: var(--font-sys);
  font-size: 11px;
}

/* ---------- Start menu ------------------------------------- */
#start-menu {
  position: fixed;
  bottom: 30px;
  left: 0;
  z-index: 10001;
  background: var(--face);
  width: 200px;
  display: flex;
}
#start-menu[hidden] {
  display: none;
}

.start-rail {
  width: 22px;
  background: linear-gradient(180deg, #1084d0 0%, #000080 100%);
  color: #c0c0c0;
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 0.05em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: right;
  padding: 8px 4px;
  font-family: var(--font-sys);
}
.start-rail span {
  color: #fff;
  font-size: 12px;
  margin-left: 6px;
}

.start-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  flex: 1;
}
.start-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.start-list li:hover {
  background: var(--title-active-a);
  color: #fff;
}
.start-list li.sep {
  height: 1px;
  margin: 4px 8px;
  padding: 0;
  background: var(--face-dark);
  border-bottom: 1px solid var(--highlight);
  cursor: default;
}
.start-list li.sep:hover {
  background: var(--face-dark);
}
.sm-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--face-light);
  border: 1px solid var(--face-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #000;
}
.start-list li:hover .sm-icon {
  color: #000;
}

/* ---------- Windows ---------------------------------------- */
#window-layer {
  position: absolute;
  inset: 0;
  pointer-events: none; /* windows themselves re-enable */
}

.window {
  position: absolute;
  pointer-events: auto;
  background: var(--face);
  padding: 2px;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  min-height: 140px;
  box-shadow:
    inset -1px -1px 0 var(--face-darker),
    inset 1px 1px 0 var(--highlight),
    inset -2px -2px 0 var(--face-dark),
    inset 2px 2px 0 var(--face-light);
}

.window.minimized {
  display: none;
}

.title-bar {
  height: 20px;
  padding: 2px 2px 2px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(
    90deg,
    var(--title-active-a) 0%,
    var(--title-active-b) 100%
  );
  color: var(--title-text);
  font-weight: bold;
  font-size: 11px;
  cursor: grab;
  user-select: none;
}
.window:not(.focused) .title-bar {
  background: linear-gradient(
    90deg,
    var(--title-inactive-a) 0%,
    var(--title-inactive-b) 100%
  );
}
.title-bar.dragging {
  cursor: grabbing;
}

.title-bar-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.title-bar-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.title-bar-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}
.title-bar-controls button {
  width: 18px;
  height: 16px;
  padding: 0;
  background: var(--face);
  font-family: var(--font-sys);
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  color: #000;
  cursor: pointer;
}
.title-bar-controls button:active {
  /* invert bevel via class toggle? Simpler: shift content 1px */
  padding: 1px 0 0 1px;
}

.window-body {
  flex: 1;
  margin: 2px 0 0;
  padding: 12px 14px;
  background: #fff;
  overflow: auto;
  font-family: var(--font-sys);
  font-size: 12px;
  line-height: 1.45;
  color: #000;
  user-select: text;
}
.window-body.gray {
  background: var(--face);
}
.window-body.flush {
  padding: 0;
  margin: 2px 0 0;
}

.window-body h2 {
  font-size: 16px;
  margin: 0 0 8px;
}
.window-body h3 {
  font-size: 13px;
  margin: 14px 0 4px;
}
.window-body p {
  margin: 0 0 8px;
}
.window-body ul,
.window-body ol {
  margin: 0 0 8px;
  padding-left: 22px;
}
.window-body hr {
  border: 0;
  border-top: 1px solid var(--face-dark);
  border-bottom: 1px solid var(--highlight);
  margin: 10px 0;
}
.window-body .muted {
  color: #555;
}
.window-body code {
  font-family: var(--font-mono);
  background: var(--face-light);
  padding: 0 3px;
}

/* In-body link styled like an OS hyperlink */
.window-body a.link,
.window-body button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #0000ee;
  text-decoration: underline;
  cursor: pointer;
}
.window-body a.link:hover,
.window-body button.link:hover {
  color: #ee0000;
}

/* File-listing inside a window */
.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.file-list li {
  padding: 4px 0;
}

/* Iframe-mode window body */
.window-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Resize handle (visual only — drag wiring is skeletal) */
.window::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  background:
    linear-gradient(135deg, transparent 0 6px, var(--face-dark) 6px 7px, transparent 7px 9px,
      var(--face-dark) 9px 10px, transparent 10px 12px);
  pointer-events: none;
}

/* ---------- About / property-sheet style ------------------- */
/* "Property sheet" look — gray panel that fills the window body,
   sunken photo frame, and fieldset group-boxes. */
.window-body > .about-page {
  margin: -12px -14px;
  padding: 14px;
  background: var(--face);
  min-height: calc(100% + 24px);
  color: #000;
  font-size: 12px;
}

.about-top {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.win-photo {
  width: 110px;
  height: 140px;
  flex: 0 0 auto;
  background: #fff;
  border-top: 1px solid var(--face-dark);
  border-left: 1px solid var(--face-dark);
  border-right: 1px solid var(--highlight);
  border-bottom: 1px solid var(--highlight);
  box-shadow:
    inset 1px 1px 0 var(--face-darker),
    inset -1px -1px 0 var(--face-light);
  padding: 2px;
  overflow: hidden;
}
.win-photo svg,
.win-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about-intro {
  flex: 1;
  min-width: 0;
}
.about-intro h2 {
  font-size: 18px;
  font-weight: bold;
  margin: 0 0 6px;
}
.about-intro .tagline {
  margin: 0 0 8px;
  font-style: italic;
  color: #333;
}
.about-intro p {
  margin: 0 0 6px;
  line-height: 1.4;
}

/* Win98 group box — sunken inset rectangle with a label that
   floats on the top-left of the border. */
.win-fieldset {
  border: 1px solid var(--face-dark);
  border-bottom-color: var(--highlight);
  border-right-color: var(--highlight);
  box-shadow:
    inset 1px 1px 0 var(--face-darker),
    inset -1px -1px 0 var(--face-light);
  padding: 10px 14px 12px;
  margin: 0 0 12px;
  background: transparent;
}
.win-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  color: #000;
  background: var(--face); /* covers the border behind the legend */
}
.win-fieldset p {
  margin: 0;
}

/* Compact list used inside fieldsets (e.g. About Me's favorite games) */
.about-games-list {
  list-style: square inside;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.55;
  columns: 2;
  column-gap: 16px;
}
.about-games-list li {
  break-inside: avoid;
  padding: 0;
}

/* Key/value table inside a group box */
table.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.kv th {
  text-align: left;
  font-weight: normal;
  color: #000;
  padding: 2px 12px 2px 0;
  width: 38%;
  white-space: nowrap;
  vertical-align: top;
}
table.kv td {
  padding: 2px 0;
  vertical-align: top;
}

.window-body .small {
  font-size: 11px;
}
.window-body .footnote {
  margin-top: 4px;
  text-align: right;
  color: #555;
}

/* ---------- Resume page ----------------------------------- */
/* Reuses the gray property-sheet look from About Me, plus a
   CSS-only tab strip (radio inputs hidden, labels styled as
   chunky Win98 property-sheet tabs). */
.window-body > .resume-page {
  margin: -12px -14px;
  padding: 10px 14px 14px;
  background: var(--face);
  min-height: calc(100% + 24px);
  color: #000;
  font-size: 12px;
}
.resume-tab-radio { display: none; }

/* Toolbar: tabs on the left, download button on the right */
.resume-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: -1px;
  position: relative;
  z-index: 2;
  gap: 8px;
  padding: 0 4px 0 0;
}

.resume-tabs {
  display: flex;
  gap: 2px;
  padding: 0 0 0 4px;
}
.resume-tabs label {
  background: var(--face);
  border: 1px solid var(--face-dark);
  border-bottom: none;
  padding: 4px 14px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  box-shadow:
    inset 1px 1px 0 var(--highlight),
    inset -1px 0 0 var(--face-dark);
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}
.resume-tabs label:hover { background: var(--face-light); }
#r-tab-swe:checked ~ .resume-toolbar .resume-tabs label[for="r-tab-swe"],
#r-tab-ai:checked  ~ .resume-toolbar .resume-tabs label[for="r-tab-ai"] {
  background: var(--face);
  font-weight: bold;
  padding-top: 5px;
  margin-top: -2px;
  z-index: 3;
}

/* Download button — Win98 raised bevel, only the active tab's link
   is shown (CSS-only via sibling selector). */
.resume-downloads { display: flex; align-items: flex-end; }
.resume-dl {
  display: none;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
  color: #000;
  padding: 6px 14px;
  background: var(--face);
  border-top: 1px solid var(--highlight);
  border-left: 1px solid var(--highlight);
  border-right: 1px solid var(--face-darker);
  border-bottom: 1px solid var(--face-darker);
  box-shadow:
    inset 1px 1px 0 var(--face-light),
    inset -1px -1px 0 var(--face-dark);
  margin-bottom: 3px;
  cursor: pointer;
  white-space: nowrap;
}
.resume-dl:hover { background: var(--face-light); }
.resume-dl:active {
  border-top-color: var(--face-darker);
  border-left-color: var(--face-darker);
  border-right-color: var(--highlight);
  border-bottom-color: var(--highlight);
  box-shadow: inset 1px 1px 0 var(--face-dark);
  padding: 7px 13px 5px 15px;
}
#r-tab-swe:checked ~ .resume-toolbar .resume-dl[data-for="swe"],
#r-tab-ai:checked  ~ .resume-toolbar .resume-dl[data-for="ai"] {
  display: inline-block;
}

/* Panels — sunken bevel like a property-sheet pane */
.resume-panels {
  border: 1px solid var(--face-dark);
  border-bottom-color: var(--highlight);
  border-right-color: var(--highlight);
  box-shadow:
    inset 1px 1px 0 var(--face-darker),
    inset -1px -1px 0 var(--face-light);
  background: var(--face);
  padding: 14px 14px 10px;
  position: relative;
}
.resume-panel { display: none; }
#r-tab-swe:checked ~ .resume-panels .resume-panel[data-tab="swe"],
#r-tab-ai:checked  ~ .resume-panels .resume-panel[data-tab="ai"] {
  display: block;
}

.resume-head { margin-bottom: 12px; }
.resume-head h2 { font-size: 18px; margin: 0 0 4px; }
.resume-contact { font-size: 12px; color: #333; margin: 0; }

.resume-job + .resume-job { margin-top: 14px; }
.resume-job-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 12px;
}
.resume-job-row.sub { margin-top: 4px; }
.resume-job-row strong { font-weight: bold; }
.resume-job-row em { font-style: italic; }
.resume-job ul {
  margin: 4px 0 0;
  padding-left: 22px;
  font-size: 12px;
  line-height: 1.5;
}
.resume-job ul + .resume-job-row.sub { margin-top: 8px; }
.resume-job ul li { margin: 2px 0; }

/* ---------- Mobile ----------------------------------------
   At phone widths there's no room for floating, draggable
   windows. Each window opens fullscreen and the OS chrome
   stays anchored. `!important` deliberately overrides the
   inline width/height/left/top that os.js sets at desktop
   sizes so windows snap to the viewport. */
@media (max-width: 700px) {
  /* Stop the body from bleeding outside the viewport — both
     axes locked so pinch-zoom only scales what's visible.
     `dvh` is the dynamic viewport height: on iOS Safari this
     updates as the URL bar collapses/expands so the OS chrome
     never sits behind the browser UI. */
  html, body {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* Desktop icons — bigger touch targets, fewer per row */
  #icons {
    padding: 12px 8px;
    gap: 10px;
  }
  .desktop-icon {
    width: 84px;
    padding: 8px 4px;
  }
  .desktop-icon .icon-img { width: 36px; height: 36px; }

  /* The right-corner game icons sit on the same desktop —
     stack them next to the left column rather than overlapping */
  #icons-right {
    top: 12px;
    right: 8px;
    gap: 10px;
  }

  /* Windows fill the viewport, taskbar still visible underneath.
     Two height declarations: `dvh`-aware browsers (iOS 15.4+,
     Chrome 108+) override with the dynamic value; older ones
     keep the `vh` fallback. */
  .window {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 30px) !important;
    height: calc(100dvh - 30px) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    transform: none !important;
    box-shadow: none;
  }

  /* Hide the maximize button — already fullscreen */
  .title-bar-controls button[data-act="max"] { display: none; }

  /* No drag affordance on mobile */
  .title-bar { cursor: default; }
  .title-bar.dragging { cursor: default; }

  /* Beef up the close + minimize buttons for touch */
  .title-bar { height: 26px; padding: 3px 4px; }
  .title-bar-controls button {
    width: 28px;
    height: 22px;
    font-size: 13px;
  }

  /* Drop the corner resize grip — irrelevant fullscreen */
  .window::after { display: none; }

  /* Taskbar — keep visible, tighter items */
  .taskbar-item {
    min-width: 0;
    max-width: 160px;
    padding: 0 6px;
  }
  #taskbar-clock { display: none; } /* save room on narrow viewports */
  #taskbar-tray { min-width: 0; padding: 0 6px; }

  /* Start menu — touch-friendly hit targets */
  #start-menu { width: 220px; }
  .start-list li { padding: 8px 12px; }
}
