/* =====================================================
   macOS-style desktop
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --menubar-h: 28px;
  --text: #f5f5f7;
  --text-dim: rgba(245, 245, 247, 0.68);
  --window-bg: #1e1e1f;
  --window-sidebar: #2a2a2c;
  --window-header: #323234;
  --hairline: rgba(255, 255, 255, 0.1);
  --accent: #0a84ff;
  --radius: 11px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Helvetica Neue', sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ---- Wallpaper ----
   Photo: Unsplash (photo-1614065043559-bce24315e298), Unsplash License.
   The deep-blue fallback colour shows if the image is slow or missing. */
#desktop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-color: #1b3a52;
  background-image: url('../img/wallpaper.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* Scrim: page text now lives inside windows, so this only needs to
   keep the menu bar and dock legible against bright parts of the photo. */
#desktop::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.42) 0%,
    rgba(0, 0, 0, 0.08) 16%,
    rgba(0, 0, 0, 0.06) 62%,
    rgba(0, 0, 0, 0.36) 100%
  );
}

/* ============ Menu bar ============ */
#menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--menubar-h);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  font-size: 13px;
  background: rgba(30, 30, 32, 0.36);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#menubar .menu-item {
  cursor: default;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}

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

#menubar .menu-item.bold {
  font-weight: 600;
}

#menubar .apple-logo {
  width: 14px;
  height: 16px;
  fill: var(--text);
  display: block;
}

#menubar .spacer {
  flex: 1;
}

#menubar .status {
  display: flex;
  align-items: center;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}

#menubar .status svg {
  width: 17px;
  height: 17px;
  fill: var(--text);
  display: block;
}

#menubar a.menu-item {
  color: inherit;
  text-decoration: none;
}

/* ============ Apple menu ============ */
#menubar #apple-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: none;
  cursor: default;
  transition: background-color 0.12s ease;
}

#menubar #apple-btn:hover,
#menubar #apple-btn[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.22);
}

#apple-menu {
  position: fixed;
  z-index: 10001;
  min-width: 248px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(246, 246, 248, 0.72);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.18);
  color: #1d1d1f;
  transform-origin: top left;
  animation: cc-open 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

#apple-menu[hidden] {
  display: none;
}

.am-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  font: inherit;
  font-size: 0.8125rem;
  color: #1d1d1f;
  text-align: left;
  background: none;
  border: none;
  border-radius: 5px;
  padding: 5px 9px;
  cursor: default;
}

.am-item:hover {
  background: #0a68e8;
  color: #fff;
}

.am-key {
  margin-left: auto;
  color: #8e8e93;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.am-item:hover .am-key {
  color: rgba(255, 255, 255, 0.85);
}

.am-submenu svg {
  margin-left: auto;
  width: 12px;
  height: 12px;
  fill: #8e8e93;
}

.am-item:hover.am-submenu svg {
  fill: #fff;
}

.am-sep {
  height: 1px;
  margin: 5px 9px;
  background: rgba(0, 0, 0, 0.13);
}

/* ============ Location popover (Control Center style) ============ */
/* Shared treatment for the menu-bar status icons (GitHub, LinkedIn, pin). */
#menubar .status .status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: none;
  color: inherit;
  text-decoration: none;
  cursor: default;
  flex-shrink: 0;
  transition: background-color 0.12s ease;
}

#menubar .status .status-icon svg {
  width: 15px;
  height: 15px;
  fill: var(--text);
  display: block;
}

#menubar .status .status-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

#menubar .status .status-icon[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.28);
}

#clock {
  white-space: nowrap;
}

#location-panel {
  position: fixed;
  z-index: 10001;
  width: 272px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 17px;
  background: rgba(246, 246, 248, 0.62);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.18);
  color: #1d1d1f;
  transform-origin: top right;
  animation: cc-open 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

#location-panel[hidden] {
  display: none;
}

@keyframes cc-open {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.cc-card {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  padding: 12px 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cc-place {
  display: flex;
  align-items: center;
  gap: 11px;
}

.cc-pin {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #0a84ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cc-pin svg {
  width: 19px;
  height: 19px;
  fill: #fff;
}

.cc-place-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cc-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
}

.cc-sub {
  font-size: 0.78rem;
  color: #6e6e73;
  line-height: 1.3;
}

.cc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cc-row + .cc-row {
  margin-top: 7px;
}

.cc-label {
  font-size: 0.8125rem;
  color: #6e6e73;
}

.cc-value {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cc-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cc-note-text {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}

/* ============ Now playing widget ============ */
#now-playing {
  position: absolute;
  top: 38px;
  left: 20px;
  z-index: 1; /* above the wallpaper scrim, below any window */
  display: flex;
  gap: 12px;
  width: 296px;
  padding: 12px;
  border-radius: 16px;
  text-decoration: none;
  color: #f5f5f7;
  background: rgba(28, 28, 30, 0.55);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  transition: background-color 0.16s ease, transform 0.16s ease;
}

#now-playing:hover {
  background: rgba(28, 28, 30, 0.68);
  transform: translateY(-2px);
  text-decoration: none;
}

.np-art {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #1db954 0%, #0d7a37 100%);
}

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

.np-art-fallback {
  width: 28px;
  height: 28px;
  fill: rgba(255, 255, 255, 0.9);
}

.np-art img:not([hidden]) + .np-art-fallback {
  display: none;
}

.np-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.np-top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}

.np-logo {
  width: 13px;
  height: 13px;
  fill: #1db954;
  flex-shrink: 0;
}

.np-status {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(245, 245, 247, 0.62);
}

.np-title,
.np-artist {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

.np-artist {
  font-size: 0.75rem;
  color: rgba(245, 245, 247, 0.66);
  line-height: 1.35;
  margin-bottom: 7px;
}

.np-bar {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.np-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: #f5f5f7;
}

.np-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.5625rem;
  color: rgba(245, 245, 247, 0.5);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ============ Desktop shortcuts ============ */
#desktop-icons {
  position: absolute;
  top: 38px;
  right: 20px;
  z-index: 1; /* above the wallpaper scrim, below any window */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 84px;
  padding: 6px 4px 5px;
  border-radius: 8px;
  text-decoration: none;
  cursor: default;
  transition: background-color 0.12s ease;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

.desktop-icon:active {
  background: rgba(10, 132, 255, 0.42);
}

/* No tile — the dragon sits straight on the wallpaper. */
.di-glyph {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.di-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Keeps the dark red readable wherever the wallpaper goes dark. */
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.45));
}

.di-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  text-align: center;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 4px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 8px rgba(0, 0, 0, 0.4);
}

/* ============ Window ============ */
.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  /* Never taller/wider than the desktop, whatever the inline size says. */
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 104px);
  background: var(--window-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  z-index: 100;
}

.window[hidden] {
  display: none;
}

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

.window.minimizing {
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.7, 0.2), opacity 0.32s ease;
  transform: scale(0.06) translateY(70vh);
  opacity: 0;
  pointer-events: none;
}

.window.opening {
  animation: window-open 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes window-open {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Title bar */
.titlebar {
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  background: var(--window-header);
  border-bottom: 1px solid var(--hairline);
  cursor: default;
}

.traffic {
  display: flex;
  gap: 8px;
  align-items: center;
}

.traffic button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.traffic .close {
  background: #ff5f57;
}
.traffic .minimize {
  background: #febc2e;
}
.traffic .zoom {
  background: #28c840;
}

.traffic button svg {
  width: 7px;
  height: 7px;
  opacity: 0;
  transition: opacity 0.12s ease;
  stroke: rgba(0, 0, 0, 0.6);
  stroke-width: 1.6;
  fill: none;
}

.traffic:hover button svg {
  opacity: 1;
}

.titlebar .title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(245, 245, 247, 0.9);
  margin-left: 4px;
}

/* ============ Mail app (Gmail compose) ============ */
.theme-mail {
  --g-blue: #0b57d0;
  --g-ink: #1f1f1f;
  --g-grey: #444746;
  --g-muted: #5f6368;
  --g-line: #e3e3e3;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  color: var(--g-ink);
}

/* Header: tinted bar, title left, window controls right. */
.theme-mail .titlebar {
  height: 40px;
  background: #f2f6fc;
  border-bottom: none;
  padding: 0 6px 0 16px;
  gap: 0;
}

.theme-mail .titlebar .title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #041e49;
  margin-left: 0;
}

/* Gmail's minimise / expand / close replace the traffic lights, but keep
   the same class names so the window manager works unchanged. */
.theme-mail .traffic {
  gap: 0;
}

.theme-mail .traffic button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: none;
  transition: background-color 0.12s ease;
}

.theme-mail .traffic button:hover {
  background: rgba(32, 33, 36, 0.09);
}

.theme-mail .traffic button svg {
  width: 20px;
  height: 20px;
  opacity: 1; /* base theme hides these until hover */
  fill: var(--g-grey);
  stroke: none;
}

.mail-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #ffffff;
}

/* Recipient / subject rows */
.mail-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--g-line);
  flex-shrink: 0;
}

.mail-prefix {
  font-size: 0.875rem;
  color: var(--g-muted);
  flex-shrink: 0;
}

.mail-ccbcc {
  font-size: 0.875rem;
  color: var(--g-muted);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.mail-field input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  color: var(--g-ink);
  padding: 11px 0;
  min-width: 0;
}

.mail-field input::placeholder {
  color: var(--g-muted);
}

.mail-field input[readonly] {
  color: var(--g-ink);
}

.mail-field.invalid {
  border-bottom-color: #d93025;
}

.mail-field.invalid input::placeholder {
  color: #d93025;
}

/* Honeypot — hidden from people, visible to naive bots. */
.mail-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-mail textarea {
  flex: 1;
  min-height: 0;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--g-ink);
  padding: 14px 16px;
  background: #ffffff;
}

.theme-mail textarea.invalid {
  background: #fef7f7;
}

.mail-status {
  margin: 0;
  padding: 0 16px 6px;
  font-size: 0.8125rem;
  min-height: 16px;
  color: var(--g-muted);
}

.mail-status.error {
  color: #d93025;
}

.mail-status.success {
  color: #188038;
}

/* Decorative formatting strip (matches Gmail's, not wired to anything). */
.mail-formatbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 12px 6px;
  padding: 7px 12px;
  border-radius: 18px;
  background: #f2f6fc;
  color: var(--g-grey);
  font-size: 0.8125rem;
  flex-shrink: 0;
  overflow: hidden;
}

.mail-formatbar svg {
  width: 17px;
  height: 17px;
  fill: var(--g-grey);
  flex-shrink: 0;
}

.fmt-font {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.fmt-font svg {
  width: 15px;
  height: 15px;
}

.fmt-b {
  font-weight: 700;
}

.fmt-i {
  font-style: italic;
  font-family: Georgia, serif;
}

.fmt-u {
  text-decoration: underline;
}

.fmt-sep {
  width: 1px;
  height: 17px;
  background: #d3d7dd;
  flex-shrink: 0;
}

/* Bottom action row */
.mail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 12px 12px;
  flex-shrink: 0;
}

.mail-send {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: var(--g-blue);
  border: none;
  border-radius: 999px;
  padding: 9px 12px 9px 22px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.mail-send:hover:not(:disabled) {
  background: #0a4fbd;
}

.mail-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.mail-send-caret {
  display: inline-flex;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.4);
}

.mail-send-caret svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.mail-tools {
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--g-grey);
  overflow: hidden;
}

.mail-tools svg {
  width: 18px;
  height: 18px;
  fill: var(--g-grey);
  flex-shrink: 0;
}

.tool-aa {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--g-grey);
  background: #d3e3fd;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mail-discard {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.12s ease;
}

.mail-discard:hover {
  background: rgba(32, 33, 36, 0.09);
}

.mail-discard svg {
  width: 18px;
  height: 18px;
  fill: var(--g-grey);
}

/* ============ About This Mac ============ */
.theme-about {
  background: linear-gradient(180deg, #f2f1ef 0%, #ecefec 55%, #e8eee9 100%);
  border-color: rgba(0, 0, 0, 0.16);
  color: #1d1d1f;
  overflow: hidden;
}

.theme-about .titlebar {
  height: 34px;
  background: none;
  border-bottom: none;
  flex-shrink: 0;
}

.theme-about .traffic button svg {
  stroke: rgba(0, 0, 0, 0.5);
}

/* The About window only offers Close; the other two sit inert, as in macOS. */
.theme-about .dot-disabled {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.14);
}

.about-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 30px 22px;
  overflow-y: auto;
  user-select: text;
}

.about-portrait {
  width: 158px;
  height: 158px;
  border-radius: 50%;
  object-fit: cover;
  margin: 14px 0 30px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

.about-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.about-sub {
  font-size: 0.8125rem;
  color: #86868b;
  margin: 0 0 24px;
}

/* Right-aligned labels against left-aligned values, like the real panel. */
.about-specs {
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px 10px;
  margin: 0 0 26px;
  font-size: 0.8125rem;
}

.about-specs dt {
  text-align: right;
  color: #1d1d1f;
  font-weight: 400;
}

.about-specs dd {
  margin: 0;
  text-align: left;
  font-weight: 600;
}

.about-footer {
  margin-top: auto;
  padding-top: 18px;
}

.about-cert {
  display: block;
  font-size: 0.75rem;
  color: #6e6e73;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-bottom: 6px;
}

.about-footer p {
  margin: 0;
  font-size: 0.6875rem;
  line-height: 1.5;
  color: #86868b;
}

/* ============ Pages (document app) ============ */
.theme-pages {
  --pg-ink: #1d1d1f;
  --pg-grey: #5b5b5f;
  background: #b8b8bc;
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--pg-ink);
}

.theme-pages .titlebar {
  height: 52px;
  background: linear-gradient(180deg, #f6f6f6 0%, #ececec 100%);
  border-bottom: 1px solid #cfcfcf;
  padding: 0 12px;
  gap: 14px;
}

.theme-pages .traffic button svg {
  stroke: rgba(0, 0, 0, 0.55);
}

.pg-tools {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-left: 6px;
}

.pg-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--pg-grey);
}

.pg-tool svg {
  width: 19px;
  height: 19px;
  fill: var(--pg-grey);
}

.pg-tool i {
  font-style: normal;
  font-size: 0.5625rem;
  letter-spacing: 0.01em;
}

.pg-sep {
  width: 1px;
  height: 26px;
  background: #cdcdcd;
  margin-top: 2px;
}

.pg-right {
  display: flex;
  gap: 7px;
}

.pg-pill {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--pg-grey);
  background: #e2e2e4;
  border: 1px solid #d2d2d4;
  border-radius: 6px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* Grey work area with the document floating on it */
.pages-canvas {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #b8b8bc;
  padding: 26px 0 40px;
  display: flex;
  justify-content: center;
  user-select: text;
  /* Reserve gutters on both sides so the scrollbar doesn't shove the
     page off-centre when the document is long enough to scroll. */
  scrollbar-gutter: stable both-edges;
}

.pages-sheet {
  width: min(612px, calc(100% - 48px));
  flex-shrink: 0;
  align-self: flex-start;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
  padding: 62px 68px 72px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--pg-ink);
}

.ps-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
}

.ps-sub {
  font-size: 0.8125rem;
  color: #86868b;
  margin: 0 0 26px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e4e4e6;
}

.ps-entry {
  margin-bottom: 22px;
}

.ps-entry:last-child {
  margin-bottom: 0;
}

.ps-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.ps-role {
  font-weight: 700;
  font-size: 0.875rem;
}

.ps-date {
  font-size: 0.75rem;
  color: #86868b;
  white-space: nowrap;
  flex-shrink: 0;
}

.ps-org {
  font-size: 0.8125rem;
  color: #6e6e73;
  font-style: italic;
  margin-bottom: 6px;
}

.pages-sheet ul {
  margin: 0;
  padding-left: 17px;
}

.pages-sheet li {
  margin-bottom: 4px;
}

/* ---- Preview: PDF viewer ---- */
.titlebar-spacer {
  flex: 1;
}

.pdf-open-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.72);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 5px;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.pdf-open-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.pdf-open-link svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
}

.pdf-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  background: #525659; /* matches the built-in PDF viewer backdrop */
}

.pdf-frame {
  flex: 1;
  border: 0;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* Rendered by <object> only when the PDF can't be displayed inline. */
.pdf-fallback {
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.pdf-fallback a {
  color: #6cb6ff;
}

/* Window body */
.window-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar */
.win-sidebar {
  width: 208px;
  flex-shrink: 0;
  background: var(--window-sidebar);
  border-right: 1px solid var(--hairline);
  padding: 10px 8px;
  overflow-y: auto;
}

.win-sidebar .section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(245, 245, 247, 0.42);
  padding: 6px 8px 4px;
}

.win-sidebar button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: rgba(245, 245, 247, 0.86);
  font: inherit;
  font-size: 0.8125rem;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.win-sidebar button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.win-sidebar button.active {
  background: var(--accent);
  color: #fff;
}

.win-sidebar button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Detail pane */
.win-detail {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 34px;
  user-select: text;
  min-width: 0;
}

.win-detail h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.win-detail .meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(245, 245, 247, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

.win-detail .stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
}

.win-detail .stack span {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(245, 245, 247, 0.82);
}

.win-detail p {
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgba(245, 245, 247, 0.8);
  margin: 0 0 13px;
}

.win-detail .visit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  padding: 7px 15px;
  border-radius: 7px;
  transition: filter 0.15s ease;
}

.win-detail .visit:hover {
  filter: brightness(1.12);
}

.win-detail .visit svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

/* ============ Notes app (light theme) ============
   Overrides the dark window chrome above to match macOS Notes. */
.theme-notes {
  --notes-amber: #d99b21;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.16);
  color: #1d1d1f;
}

.theme-notes .titlebar {
  height: 46px;
  background: #ebebeb;
  border-bottom: 1px solid #d8d8d8;
  gap: 12px;
  padding: 0 12px;
}

.theme-notes .traffic button svg {
  stroke: rgba(0, 0, 0, 0.55);
}

.theme-notes .notes-tools {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-left: 6px;
}

.theme-notes .notes-tools svg {
  width: 17px;
  height: 17px;
  fill: #7b7b7f;
  display: block;
}

.theme-notes .tool-sep {
  width: 1px;
  height: 17px;
  background: #cfcfcf;
}

.theme-notes .notes-search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 148px;
  padding: 4px 9px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #d5d5d5;
  color: #a1a1a6;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.theme-notes .notes-search svg {
  width: 13px;
  height: 13px;
  fill: #a1a1a6;
  flex-shrink: 0;
}

/* Note list pane */
.theme-notes .notes-list {
  width: 232px;
  flex-shrink: 0;
  background: #fbfbfb;
  border-right: 1px solid #e2e2e2;
  padding: 6px 8px 10px;
  overflow-y: auto;
}

.theme-notes .notes-list-header {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1d1d1f;
  padding: 8px 8px 6px;
}

.theme-notes .note-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.theme-notes .note-item:hover {
  background: rgba(0, 0, 0, 0.045);
}

.theme-notes .note-item.active {
  background: #ffe8a3;
}

.theme-notes .note-item-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 2px;
}

.theme-notes .note-item-meta {
  display: block;
  font-size: 0.75rem;
  color: #86868b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-notes .note-item-date {
  color: #1d1d1f;
  margin-right: 5px;
}

/* Note content pane */
.theme-notes .notes-content {
  flex: 1;
  overflow-y: auto;
  background: #ffffff;
  padding: 16px 46px 28px;
  user-select: text;
  min-width: 0;
}

.theme-notes .note-timestamp {
  text-align: center;
  font-size: 0.6875rem;
  color: #9b9b9f;
  margin-bottom: 22px;
}

.theme-notes .note-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1d1d1f;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.theme-notes .note-lead {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 14px;
}

.theme-notes .notes-content p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #1d1d1f;
  margin: 0 0 14px;
}

.theme-notes .note-heading {
  font-weight: 700;
  margin-top: 24px !important;
  margin-bottom: 8px !important;
}

.theme-notes .note-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.theme-notes .note-links li {
  font-size: 0.9375rem;
  line-height: 1.75;
}

.theme-notes .note-links a {
  color: var(--notes-amber);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.theme-notes .note-links a:hover {
  color: #b87d10;
}

.theme-notes ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.22);
}

.theme-notes ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.34);
}

/* Resize handle */
.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 5;
}

/* ============ Dock ============ */
#dock {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  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.35);
}

.dock-app {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  transform-origin: bottom center;
}

.dock-app:hover {
  transform: scale(1.22) translateY(-6px);
}

.dock-app .icon {
  width: 54px;
  height: 54px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.dock-app .icon.projects {
  background: linear-gradient(160deg, #6fc3ff 0%, #2a7fe0 100%);
}

.dock-app .icon.mail {
  background: linear-gradient(160deg, #55c1ff 0%, #1a7fe8 100%);
}

.dock-app .icon.pages {
  background: linear-gradient(160deg, #ffb340 0%, #f08a1c 100%);
}

.dock-app .icon.pages svg {
  width: 34px;
  height: 34px;
  fill: #fff;
}

/* Notes: yellow header strip over lined white paper. */
.dock-app .icon.notes {
  background: linear-gradient(
    180deg,
    #ffd95e 0%,
    #fccf3f 26%,
    #ffffff 26%,
    #f4f4f4 100%
  );
}

.dock-app .icon.notes svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #d6d6d6;
  stroke-width: 2;
  stroke-linecap: round;
  filter: none;
}

.dock-app .icon svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.22));
}

.dock-app .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.dock-app.running .dot {
  opacity: 1;
}

.dock-app .tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  background: rgba(50, 50, 52, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

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

/* ============ Scrollbars ============ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  #menubar .hide-sm {
    display: none;
  }

  #menubar {
    gap: 10px;
    padding: 0 10px;
  }

  #menubar .status {
    gap: 10px;
  }

  #greeting {
    padding-bottom: 110px;
  }

  #greeting .avatar {
    width: 84px;
    height: 84px;
    margin-bottom: 16px;
  }

  .window {
    top: calc(var(--menubar-h) + 8px) !important;
    left: 8px !important;
    width: calc(100vw - 16px) !important;
    height: calc(100vh - var(--menubar-h) - 108px) !important;
  }

  .win-sidebar {
    width: 138px;
  }

  .win-detail {
    padding: 20px 18px 26px;
  }

  .theme-notes .notes-list {
    width: 132px;
    padding: 4px 5px 8px;
  }

  .theme-notes .notes-content {
    padding: 14px 18px 28px;
  }

  .theme-notes .notes-search {
    display: none;
  }


  .resize-handle {
    display: none;
  }
}
