/* ==================================================================
   MSCPaian — a macOS desktop, in CSS.
   ================================================================== */

/* ---------- design tokens ---------- */
:root {
  --menubar-h: 26px;
  --dock-h: 62px;

  --text: #f5f5f7;
  --text-dark: #1d1d1f;

  --glass: rgba(255, 255, 255, 0.18);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-line: rgba(255, 255, 255, 0.30);

  --accent: #0a84ff;
  --radius: 12px;

  /* the desktop colour — a solid deep blue, as in System Settings → Wallpaper → Colors */
  --wallpaper: #1f3a5f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Helvetica Neue", sans-serif;
  color: var(--text);
  overflow: hidden;            /* the desktop never scrolls — windows do */
  user-select: none;           /* dragging shouldn't select text */
  -webkit-font-smoothing: antialiased;
}


/* ==================================================================
   THE WALLPAPER
   One solid colour, the way a real Mac does it under System Settings →
   Wallpaper → Colors. The only extra is a faint vignette, so the corners
   sit back a touch the way they do on a real display. (It used to be four
   coloured blobs — the "aurora" look that now reads as AI-generated.)
   ================================================================== */
#desktop {
  position: fixed;
  inset: 0;                    /* shorthand for top/right/bottom/left: 0 */

  background:
    radial-gradient(ellipse 120% 100% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.22)),
    var(--wallpaper);
}


/* ==================================================================
   MENU BAR
   ================================================================== */
#menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--menubar-h);
  z-index: 9000;

  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;

  font-size: 13px;
  background: rgba(0, 0, 0, 0.28);

  /* the frosted-glass effect: blur whatever is BEHIND this element */
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

#menubar .apple { font-size: 15px; line-height: 1; }
#menubar .app-name { font-weight: 600; }
#menubar .menu-item { opacity: 0.9; }

#menubar .menu-item,
#menubar .apple,
#menubar .tray-item {
  padding: 2px 7px;
  border-radius: 5px;
  cursor: default;
}

#menubar .menu-item:hover,
#menubar .apple:hover,
#menubar .tray-item:hover { background: rgba(255, 255, 255, 0.22); }

/* margin-left:auto pushes this group all the way to the right */
#menubar .tray {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

#menubar .tray svg { display: block; }

#clock { font-variant-numeric: tabular-nums; white-space: nowrap; }


/* ==================================================================
   DESKTOP ICONS  (top-right column)
   ================================================================== */
#icons {
  position: fixed;
  top: calc(var(--menubar-h) + 14px);
  right: 18px;
  z-index: 100;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

.desktop-icon {
  width: 92px;
  padding: 6px 4px 5px;
  border-radius: 8px;
  text-align: center;
  cursor: default;
}

.desktop-icon .glyph {
  width: 52px;
  height: 52px;
  margin: 0 auto 3px;
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.45));
}

.desktop-icon .glyph svg { width: 100%; height: 100%; display: block; }

.desktop-icon .label {
  font-size: 12px;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  padding: 1px 4px;
  border-radius: 4px;
  display: inline-block;
}

/* single click selects — same as the real thing */
.desktop-icon.selected { background: rgba(10, 132, 255, 0.28); }
.desktop-icon.selected .label { background: var(--accent); }


/* ==================================================================
   WINDOW
   ================================================================== */
.window {
  position: fixed;
  z-index: 500;

  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - var(--menubar-h) - var(--dock-h) - 50px);

  display: flex;
  flex-direction: column;

  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(246, 245, 243, 0.92);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.5),
    0 0 0 0.5px rgba(0, 0, 0, 0.3);

  color: var(--text-dark);
}

.window.hidden { display: none; }

.window.maximized {
  top: var(--menubar-h) !important;
  left: 0 !important;
  width: 100vw;
  max-height: calc(100vh - var(--menubar-h) - var(--dock-h) - 12px);
}

/* ---------- title bar ---------- */
.titlebar {
  height: 38px;
  flex-shrink: 0;                /* never squash the title bar */

  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;

  background: rgba(228, 226, 223, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  cursor: grab;                  /* the visual cue that it drags */
}

.titlebar:active { cursor: grabbing; }

.lights { display: flex; gap: 8px; }

.light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
}

.light.red    { background: #ff5f57; }
.light.yellow { background: #febc2e; }
.light.green  { background: #28c840; }

/* the little glyphs only appear when you hover the group */
.light::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.12s;
}

.lights:hover .light::after { opacity: 1; }
.light.red::after    { content: "✕"; }
.light.yellow::after { content: "–"; }
.light.green::after  { content: "+"; }

.titlebar .title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #3a3a3c;
  margin-right: 52px;            /* balances the traffic lights */
}

/* ---------- window body ---------- */
.window-body {
  overflow-y: auto;              /* THIS scrolls, not the page */
  padding: 26px 30px 30px;
  user-select: text;             /* text inside a window is selectable */
}


/* ==================================================================
   CV CONTENT
   ================================================================== */
.cv h1 { font-size: 27px; font-weight: 600; letter-spacing: -0.4px; }

.cv .nickname { color: #c1440e; font-size: 14px; font-weight: 500; margin-top: 2px; }
.cv .role     { color: #6b6b6b; font-size: 15px; margin-top: 8px; }

.cv header {
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.cv .avatar {
  width: 78px;
  height: 78px;
  flex-shrink: 0;              /* never let the text squash the photo */
  border-radius: 50%;
  object-fit: cover;           /* crop to fill, don't stretch */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.cv h2 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: #8a8a8e;
  padding-bottom: 7px;
  border-bottom: 1px solid #dededa;
  margin-bottom: 16px;
}

.cv section { margin-bottom: 30px; }

.cv dl {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 9px 14px;
}

.cv dt { color: #8a8a8e; font-size: 13px; }
.cv dd { font-size: 14px; }

.cv ol { list-style: none; }

.cv li {
  position: relative;
  padding-left: 24px;
  padding-bottom: 22px;
  border-left: 1px solid #dededa;
}

.cv li:last-child { border-left-color: transparent; padding-bottom: 0; }

.cv li::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6d5d1;
}

.cv li.now::before { background: #c1440e; }

.cv .year   { font-size: 12px; color: #8a8a8e; font-variant-numeric: tabular-nums; }
.cv .title  { font-weight: 600; margin-top: 1px; font-size: 14px; }
.cv .detail { font-size: 13px; color: #8a8a8e; margin-top: 2px; }

/* the journey now comes over the network, so it can fail to arrive */
.cv li.load-error {
  border-left-color: transparent;
  padding-bottom: 0;
  font-size: 13px;
  color: #8a8a8e;
}
.cv li.load-error::before { background: #c1440e; }

.cv button {
  font: inherit;
  font-size: 13px;
  color: #c1440e;
  background: none;
  border: 1px dashed #d6d5d1;
  border-radius: 8px;
  padding: 7px 13px;
  cursor: pointer;
  margin-top: 4px;
}

.cv button:hover { border-color: #c1440e; }

.cv footer {
  font-size: 12px;
  color: #a1a1a6;
  padding-top: 18px;
  border-top: 1px solid #dededa;
}


/* ==================================================================
   DOCK
   ================================================================== */
#dock-wrap {
  position: fixed;
  bottom: 6px;
  left: 0; right: 0;
  z-index: 8000;

  display: flex;
  justify-content: center;
  pointer-events: none;            /* the empty space beside the dock stays clickable */
}

#dock {
  pointer-events: auto;

  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px;

  max-width: calc(100vw - 16px);

  background: var(--glass);
  border: 0.5px solid var(--glass-line);
  border-radius: 18px;
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
}

.dock-app {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;

  /* clamp(min, preferred, max) — macOS shrinks Dock icons to fit rather
     than scrolling, so the size tracks the viewport width and stops at
     both ends. 3.4vw = 3.4% of the window width. */
  width:  clamp(26px, 3.4vw, 46px);
  height: clamp(26px, 3.4vw, 46px);

  /* grow UPWARDS from the bottom edge, like the real Dock */
  transform-origin: bottom center;
  transition: transform 0.18s cubic-bezier(0.25, 1.4, 0.5, 1);
}

.dock-app:hover { transform: scale(1.38) translateY(-4px); }

/* the immediate neighbours lift a little too */
.dock-app:hover + .dock-app,
.dock-app:has(+ .dock-app:hover) { transform: scale(1.16) translateY(-2px); }

.dock-app svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

/* tooltip */
.dock-app::after {
  content: attr(data-name);
  position: absolute;
  bottom: 112%;
  left: 50%;
  transform: translateX(-50%);

  padding: 3px 9px;
  font-size: 12px;
  white-space: nowrap;
  color: #fff;
  background: rgba(40, 40, 42, 0.92);
  border-radius: 6px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s;
}

.dock-app:hover::after { opacity: 1; }

/* notification badge */
.dock-app .badge {
  position: absolute;
  top: -2px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;

  display: grid;
  place-items: center;

  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #ff3b30;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 9px;
}

/* the "app is running" dot underneath */
.dock-app .running {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.dock-sep {
  flex-shrink: 0;
  width: 1px;
  height: 42px;
  margin: 0 4px;
  align-self: center;
  background: rgba(255, 255, 255, 0.3);
}


/* ==================================================================
   TOAST — for the decorative apps that aren't wired up
   ================================================================== */
#toast {
  position: fixed;
  bottom: calc(var(--dock-h) + 26px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 9500;

  padding: 9px 16px;
  font-size: 13px;
  color: #fff;
  background: rgba(30, 30, 32, 0.92);
  border-radius: 10px;
  backdrop-filter: blur(12px);

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ==================================================================
   SMALL SCREENS
   A Dock and draggable windows make no sense on a phone, so the
   desktop metaphor is dropped and the CV becomes a normal page.
   ================================================================== */
@media (max-width: 700px) {
  body { overflow: auto; }

  #menubar { gap: 10px; font-size: 12px; }
  #menubar .menu-item { display: none; }

  #icons {
    position: static;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    padding: calc(var(--menubar-h) + 16px) 12px 4px;
  }

  .window {
    position: static !important;
    width: auto;
    max-height: none;
    margin: 14px 12px calc(var(--dock-h) + 24px);
  }

  .window.hidden { display: flex; }     /* always visible on mobile */
  .titlebar { cursor: default; }

  #dock { gap: 3px; padding: 5px 6px; border-radius: 15px; }
  .dock-app { width: 30px; height: 30px; }
  .dock-app:hover { transform: none; }
  .dock-app::after { display: none; }
}
