/* ============================================================
   macOS Portfolio — Yusuf Fachroni
   ============================================================ */

:root {
  --menubar-h: 28px;
  --dock-h: 68px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --win-radius: 12px;
  --win-shadow: 0 22px 70px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  /* macOS Sonoma wallpaper, with a gray gradient fallback while it loads */
  background:
    url("../assets/wallpaper/macos.jpg") center / cover no-repeat,
    linear-gradient(160deg, #9aa0ab 0%, #5c626e 45%, #2e323c 100%);
  background-color: #3a3e48;
  user-select: none;
}

/* ============ BOOT ============ */
#boot {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 46px;
  transition: opacity .6s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot-apple { width: 74px; height: 90px; }
#boot-bar {
  width: 180px; height: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, .22); overflow: hidden;
}
#boot-progress {
  width: 0%; height: 100%; border-radius: 3px; background: #fff;
  transition: width .3s ease;
}

/* ============ MENU BAR ============ */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--menubar-h);
  z-index: 5000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  color: #fff;
  font-size: 13px;
  background: rgba(40, 30, 60, .35);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  text-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 4px; }
.mb-item {
  padding: 3px 9px; border-radius: 5px; cursor: default;
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; color: inherit; font: inherit;
}
.mb-apple, .mb-appname, .mb-menu { cursor: pointer; }
.mb-apple:hover, .mb-menu:hover, .mb-appname:hover { background: rgba(255,255,255,.16); }
.mb-appname { font-weight: 700; }

.dropdown {
  position: fixed; top: calc(var(--menubar-h) + 4px); left: 8px;
  min-width: 220px;
  background: rgba(245, 245, 250, .85);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border-radius: 10px;
  border: .5px solid rgba(255,255,255,.5);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  padding: 5px;
  z-index: 6000;
}
.dd-item {
  display: block; width: 100%; text-align: left;
  padding: 5px 10px; border-radius: 6px;
  font-size: 13px; color: #1c1c1e; text-decoration: none;
  background: none; border: none; font-family: inherit; cursor: pointer;
}
.dd-item:hover { background: #2f7cf6; color: #fff; }
.dd-sep { height: 1px; margin: 4px 10px; background: rgba(0,0,0,.12); }

/* ============ DESKTOP ============ */
#desktop {
  position: fixed; inset: var(--menubar-h) 0 0 0;
}

#desktop-icons {
  position: absolute; top: 14px; right: 10px;
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
  z-index: 10;
}
.desk-icon {
  width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px 2px;
  border-radius: 8px;
  text-decoration: none;
}
.desk-icon.selected, .desk-icon:focus-visible { background: rgba(60, 120, 255, .35); outline: none; }
.di-img { width: 52px; height: 52px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.di-img svg { width: 100%; height: 100%; }
.di-label {
  font-size: 11.5px; color: #fff; text-align: center; line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0,0,0,.65);
  word-break: break-word;
}

/* ============ WINDOWS ============ */
.window {
  position: absolute;
  min-width: 320px;
  border-radius: var(--win-radius);
  box-shadow: var(--win-shadow);
  background: #f5f5f7;
  overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 1;
  transform-origin: 50% 100%;
  transition: opacity .22s ease, transform .22s ease;
}
.window.opening { animation: winOpen .28s cubic-bezier(.2,.9,.3,1.2); }
@keyframes winOpen {
  from { opacity: 0; transform: scale(.85) translateY(30px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.window.minimizing { opacity: 0; transform: scale(.4) translateY(55vh); pointer-events: none; }
.window.closing { opacity: 0; transform: scale(.92); pointer-events: none; }
.window.maximized {
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: calc(100% - var(--dock-h) - 6px) !important;
  border-radius: 0;
}

.titlebar {
  height: 40px; flex: 0 0 auto;
  display: flex; align-items: center;
  padding: 0 12px;
  cursor: grab;
  position: relative;
  background: linear-gradient(#fdfdfd, #f1f1f3);
  border-bottom: 1px solid rgba(0,0,0,.1);
}
.titlebar:active { cursor: grabbing; }
.titlebar-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 600; color: #4a4a4f;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 60%;
}
.window:not(.focused) .titlebar-title { color: #9a9aa0; }

.traffic { display: flex; gap: 8px; align-items: center; z-index: 2; }
.tl {
  width: 12px; height: 12px; border-radius: 50%;
  border: .5px solid rgba(0,0,0,.15);
  padding: 0; cursor: pointer;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
}
.tl-close { background: #ff5f57; }
.tl-min   { background: #febc2e; }
.tl-max   { background: #28c840; }
.window:not(.focused) .tl { background: #d9d9de; }
.tl::after {
  font-size: 9px; font-weight: 700; color: rgba(0,0,0,.55);
  opacity: 0; line-height: 1;
}
.traffic:hover .tl::after { opacity: 1; }
.tl-close::after { content: "\2715"; font-size: 7.5px; }
.tl-min::after   { content: "\2013"; }
.tl-max::after   { content: "\2922"; font-size: 8px; }

/* Dark titlebars */
.dark-titlebar, .xcode-titlebar {
  background: linear-gradient(#3a3a40, #2d2d33);
  border-bottom: 1px solid #000;
}
.dark-titlebar .titlebar-title { color: #d8d8dc; }

/* ============ NOTES ============ */
#win-notes { width: 760px; height: 500px; }
.notes-titlebar { background: linear-gradient(#fbf8ef, #f3efe2); }
.notes-body { flex: 1; display: flex; min-height: 0; background: #fff; }
.notes-sidebar {
  width: 200px; flex: 0 0 auto;
  background: #f4f0e6;
  border-right: 1px solid rgba(0,0,0,.1);
  overflow-y: auto;
  padding: 10px 8px;
}
.notes-side-head {
  font-size: 11px; font-weight: 700; color: #9c9584;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px 6px;
}
.notes-folder {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: #3d3a33;
  padding: 6px 8px; border-radius: 7px;
}
.notes-folder.active { background: rgba(247, 201, 72, .35); }
.notes-count { margin-left: auto; color: #9c9584; font-weight: 400; font-size: 12px; }
.notes-list { list-style: none; margin: 8px 0 0; padding: 0; }
.notes-list li {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  margin-bottom: 2px;
}
.notes-list li.active { background: #f7c948; }
.notes-list .nl-title { font-size: 13px; font-weight: 700; color: #35322b; display: block; }
.notes-list .nl-sub { font-size: 11px; color: #8d8776; display: block; margin-top: 2px; }
.notes-list li.active .nl-sub { color: #6b5a1d; }
.notes-content {
  flex: 1; overflow-y: auto; padding: 26px 32px;
  background: #fff;
  user-select: text;
}
.notes-date { text-align: center; color: #b0b0b5; font-size: 11.5px; margin: 0 0 14px; }
.notes-h1 { font-size: 24px; font-weight: 800; margin: 0 0 12px; color: #1c1c1e; }
.notes-p { font-size: 14px; line-height: 1.65; color: #2c2c2e; margin: 0 0 12px; }
.notes-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 16px; }
.notes-tag {
  font-size: 12px; font-weight: 600;
  background: #fdf3d3; color: #8a6d1a;
  border: 1px solid #f0dfa0;
  padding: 3px 10px; border-radius: 20px;
}
.notes-check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px; font-size: 14px; color: #2c2c2e; }
.notes-check svg { flex: 0 0 auto; margin-top: 2px; }

/* ============ KEYNOTE / POWERPOINT ============ */
#win-keynote { width: 860px; height: 560px; background: #232326; }
.keynote-body { flex: 1; min-height: 0; background: #1a1a1c; }
#canva-frame { width: 100%; height: 100%; border: none; display: block; background: #1a1a1c; }

/* ============ XCODE ============ */
#win-xcode { width: 1150px; height: 640px; background: #1f1f24; }
.xcode-titlebar { display: flex; gap: 14px; height: 44px; }
.xcode-toolbar {
  flex: 1; display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.xc-run {
  width: 26px; height: 26px; border-radius: 6px;
  border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #9fd1ff;
  display: inline-flex; align-items: center; justify-content: center;
}
.xc-run:hover { background: rgba(255,255,255,.2); }
.xc-scheme {
  font-size: 12px; color: #c8c8cd;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.xc-device { color: #98989f; }
.xc-status {
  margin-left: auto; margin-right: 4px;
  background: #2a2a30; border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px;
  min-width: 150px; max-width: 300px;
  padding: 3px 12px;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
}
.xc-status-text { font-size: 11px; color: #d5d5da; white-space: nowrap; }
.xc-status-sub { font-size: 9.5px; color: #85858c; }

.xcode-body { flex: 1; display: flex; min-height: 0; color: #ddd; }

/* Mobile-only project picker + Code/Preview toggle */
.xc-mobile-bar { display: none; }
.xc-mseg {
  display: flex; gap: 6px;
  padding: 8px 10px 0;
}
.xc-mseg button {
  flex: 1;
  border: none; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #98989f;
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 0;
}
.xc-mseg button.active { background: #2f5aa5; color: #fff; }
.xc-mpicker {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  scrollbar-width: none;
}
.xc-mpicker::-webkit-scrollbar { display: none; }
.xc-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05); color: #c9c9cf;
  border-radius: 15px;
  font: inherit; font-size: 12px;
  padding: 5px 13px;
  white-space: nowrap;
}
.xc-chip.active { background: #4ca6ff; border-color: #4ca6ff; color: #0b2545; font-weight: 700; }

.xc-navigator {
  width: 220px; flex: 0 0 auto;
  background: #26262b;
  border-right: 1px solid #000;
  display: flex; flex-direction: column;
  min-height: 0;
}
.xc-nav-tabs {
  display: flex; gap: 2px; padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.xc-nav-tab {
  padding: 4px 8px; border-radius: 5px; color: #85858c;
  display: inline-flex;
}
.xc-nav-tab.active { color: #4ca6ff; background: rgba(255,255,255,.07); }
.xc-tree { flex: 1; overflow-y: auto; padding: 6px 0; font-size: 12.5px; }
.xc-group {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px; color: #b9b9c0; font-weight: 600;
}
.xc-group .chev { color: #85858c; font-size: 9px; }
.xc-file {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 30px;
  cursor: pointer; color: #c9c9cf;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xc-file:hover { background: rgba(255,255,255,.05); }
.xc-file.active { background: #2f5aa5; color: #fff; }
.xc-file svg { flex: 0 0 auto; }

.xc-editor { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #1f1f24; }
.xc-tabs {
  display: flex; overflow-x: auto; scrollbar-width: none;
  background: #26262b; border-bottom: 1px solid #000;
  flex: 0 0 auto;
}
.xc-tabs::-webkit-scrollbar { display: none; }
.xc-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  font-size: 12px; color: #98989f;
  border-right: 1px solid rgba(0,0,0,.5);
  cursor: pointer; white-space: nowrap;
  background: #232328;
}
.xc-tab.active { background: #1f1f24; color: #e8e8ec; box-shadow: inset 0 2px 0 #4ca6ff; }
.xc-tab .tab-x { opacity: 0; font-size: 10px; color: #85858c; }
.xc-tab:hover .tab-x { opacity: 1; }
.xc-tab .tab-x:hover { color: #fff; }

.xc-breadcrumb {
  flex: 0 0 auto;
  padding: 5px 14px;
  font-size: 11.5px; color: #85858c;
  border-bottom: 1px solid rgba(255,255,255,.05);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.xc-breadcrumb b { color: #b9b9c0; font-weight: 600; }

.xc-code-scroll { flex: 1; overflow: auto; min-height: 0; }

/* Dark scrollbars inside the Xcode window */
.xc-code-scroll, .xc-tree {
  scrollbar-color: #4a4a52 #1f1f24; /* Firefox */
}
.xc-code-scroll::-webkit-scrollbar,
.xc-tree::-webkit-scrollbar {
  width: 11px; height: 11px;
  background: #1f1f24;
}
.xc-code-scroll::-webkit-scrollbar-thumb,
.xc-tree::-webkit-scrollbar-thumb {
  background: #4a4a52;
  border-radius: 6px;
  border: 2.5px solid #1f1f24; /* inset pill look */
}
.xc-code-scroll::-webkit-scrollbar-thumb:hover,
.xc-tree::-webkit-scrollbar-thumb:hover { background: #62626c; }
.xc-code-scroll::-webkit-scrollbar-corner,
.xc-tree::-webkit-scrollbar-corner { background: #1f1f24; }
.xc-tree::-webkit-scrollbar { background: #26262b; }
.xc-tree::-webkit-scrollbar-thumb { border-color: #26262b; }
.xc-tree { scrollbar-color: #4a4a52 #26262b; }
.xc-code {
  margin: 0; padding: 12px 0 40px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.62;
  color: #dfdfe4;
  min-width: max-content;
  user-select: text;
}
.xc-line { display: flex; }
.xc-ln {
  flex: 0 0 46px; text-align: right; padding-right: 14px;
  color: #55555e; user-select: none;
}
.xc-lc { padding-right: 24px; white-space: pre; }

/* Xcode syntax colors (default dark theme) */
.tok-kw   { color: #fc5fa3; font-weight: 600; }
.tok-type { color: #9ef1dd; }
.tok-str  { color: #fc6a5d; }
.tok-num  { color: #d0bf69; }
.tok-com  { color: #6c7986; }
.tok-doc  { color: #73a377; }
.tok-prop { color: #67b7a4; }
.tok-fn   { color: #a167e6; }
.tok-attr { color: #fd8f3f; }

/* Simulator */
.xc-simulator {
  width: 300px; flex: 0 0 auto;
  background: #151518;
  border-left: 1px solid #000;
  display: flex; flex-direction: column;
  min-height: 0;
}
.sim-titlebar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 11px; color: #98989f;
  padding: 8px;
  background: #202024; border-bottom: 1px solid #000;
  white-space: nowrap; overflow: hidden;
}
.sim-dot { width: 7px; height: 7px; border-radius: 50%; background: #28c840; }
.sim-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 18px 10px;
}
.iphone {
  position: relative;
  height: 100%; max-height: 540px;
  aspect-ratio: 9 / 19;
  background: #000;
  border-radius: 38px;
  border: 3px solid #3a3a40;
  box-shadow: 0 0 0 2px #17171a, 0 18px 45px rgba(0,0,0,.6);
  overflow: hidden;
  display: flex;
}
.iphone-island {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 32%; height: 16px; border-radius: 12px;
  background: #000; z-index: 3;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05);
}
.iphone-screen {
  flex: 1; background: #0b0b0d;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.iphone-screen img { width: 100%; height: 100%; object-fit: cover; }
.iphone-screen iframe { width: 100%; height: 100%; border: none; }
.iphone-bar {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  width: 36%; height: 4px; border-radius: 3px;
  background: rgba(255,255,255,.45); z-index: 3;
}

/* ============ ABOUT ============ */
#win-about { width: 540px; }
.about-titlebar { background: linear-gradient(#fdfdfd, #f1f1f3); }
.about-body {
  padding: 28px 34px 30px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  overflow-y: auto;
  user-select: text;
}
.about-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  margin-bottom: 14px;
  background: #fff;
  object-fit: cover;
}
.about-name { font-size: 24px; font-weight: 800; margin: 0; color: #1c1c1e; }
.about-role { font-size: 13px; color: #8e8e93; margin: 4px 0 18px; }
.about-specs { width: 100%; max-width: 380px; font-size: 13px; margin-bottom: 16px; }
.about-specs div {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,.06);
}
.about-specs span { color: #8e8e93; white-space: nowrap; }
.about-specs b { color: #1c1c1e; font-weight: 600; text-align: right; }
.about-hello { font-size: 13px; line-height: 1.6; color: #3a3a3c; margin: 0 0 18px; }
.about-actions { display: flex; gap: 10px; }
.btn-mac {
  background: #2f7cf6; color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 8px;
}
.btn-mac:hover { background: #1e6ae4; }
.btn-secondary { background: #e9e9ec; color: #1c1c1e; }
.btn-secondary:hover { background: #dededf; }

/* ============ FINDER (Medium Articles) ============ */
#win-articles { width: 820px; height: 540px; }
.finder-titlebar { height: 44px; display: flex; align-items: center; gap: 12px; }
.finder-nav { display: flex; gap: 12px; color: #6e6e73; margin-left: 6px; }
.finder-body { flex: 1; display: flex; min-height: 0; }
.finder-sidebar {
  width: 168px; flex: 0 0 auto;
  background: rgba(238, 238, 242, .92);
  border-right: 1px solid rgba(0,0,0,.1);
  padding: 10px 8px;
  overflow-y: auto;
  font-size: 12.5px;
}
.fs-head {
  font-size: 10.5px; font-weight: 700; color: #9a9aa0;
  text-transform: uppercase; letter-spacing: .3px;
  padding: 8px 8px 4px;
}
.fs-item {
  display: flex; align-items: center; gap: 7px;
  color: #3a3a3f;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap;
}
.fs-item.active { background: rgba(0,0,0,.08); font-weight: 600; }
.fs-ic { font-size: 12px; }
.fs-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.finder-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
.doc-grid {
  flex: 1; overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 20px 8px;
  padding: 22px 18px;
  align-content: start;
}
.finder-loading { grid-column: 1/-1; text-align: center; color: #8e8e93; font-size: 13px; padding: 50px 0; }
.doc-item {
  border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 8px 4px; border-radius: 8px;
}
.doc-item:hover { background: rgba(0,0,0,.05); }
.doc-item.selected { background: rgba(60, 120, 255, .18); }
.doc-thumb {
  width: 86px; height: 108px;
  background: #fff;
  border: 1px solid #cfcfd6;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
}
.doc-thumb img {
  width: 100%; height: 54px; object-fit: cover; display: block;
  background: #eceff3;
  flex: 0 0 auto;
}
.doc-thumb .doc-lines { padding: 7px 8px; display: flex; flex-direction: column; gap: 4px; }
.doc-thumb .doc-lines i {
  display: block; height: 3px; border-radius: 2px; background: #d5d8de;
}
.doc-thumb .doc-lines i:nth-child(2) { width: 85%; }
.doc-thumb .doc-lines i:nth-child(4) { width: 70%; }
.doc-thumb .doc-lines i:nth-child(6) { width: 40%; }
.doc-badge {
  position: absolute; bottom: 6px; left: 8px;
  font-size: 7.5px; font-weight: 800; letter-spacing: .4px;
  color: #fff; background: #4ba3f5;
  padding: 2px 5px; border-radius: 3px;
}
.doc-title {
  font-size: 11.5px; line-height: 1.3; color: #2c2c2e;
  text-align: center;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 120px;
}
.finder-statusbar {
  flex: 0 0 auto;
  border-top: 1px solid rgba(0,0,0,.08);
  padding: 5px 14px;
  font-size: 11px; color: #8e8e93;
  background: #f7f7f9;
  text-align: center;
}

/* ============ SAFARI ============ */
#win-safari { width: 940px; height: 620px; }
.safari-titlebar {
  height: 46px;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(#f6f6f8, #ececef);
}
.safari-nav { display: flex; gap: 4px; margin-left: 6px; }
.saf-btn {
  width: 28px; height: 28px; border-radius: 7px;
  border: none; background: none; cursor: pointer;
  color: #6e6e73;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.saf-btn:hover { background: rgba(0,0,0,.07); }
.safari-urlbar {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(0,0,0,.06);
  border-radius: 8px;
  height: 30px;
  font-size: 12.5px; color: #4a4a4f;
  min-width: 0;
  padding: 0 12px;
}
.safari-urlbar svg { color: #8e8e93; flex: 0 0 auto; }
#safari-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.safari-body { flex: 1; min-height: 0; background: #fff; overflow-y: auto; }
.safari-body iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }
.safari-body .safari-frame-wrap { width: 100%; height: 100%; }

/* Safari start page */
.saf-start {
  min-height: 100%;
  background: linear-gradient(180deg, #f3f3f7 0%, #e9e9f2 100%);
  padding: 40px 44px 30px;
}
.saf-start h2 { font-size: 21px; font-weight: 800; color: #3a3a3f; margin: 0 0 18px; }
.saf-favs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 8px; }
.saf-fav {
  border: none; background: none; cursor: pointer; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border-radius: 10px;
}
.saf-fav:hover { background: rgba(0,0,0,.05); }
.saf-fav .fav-ic { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.saf-fav .fav-ic svg, .saf-fav .fav-ic img { width: 100%; height: 100%; display: block; }
.saf-fav span { font-size: 12px; color: #4a4a4f; }

/* Social preview "web page" cards */
.sp-page { min-height: 100%; display: flex; flex-direction: column; background: #fff; }
.sp-hero { height: 130px; flex: 0 0 auto; }
.sp-main { padding: 0 40px 34px; max-width: 620px; margin: 0 auto; width: 100%; text-align: center; }
.sp-avatar {
  width: 108px; height: 108px; border-radius: 50%;
  border: 4px solid #fff;
  margin: -54px auto 12px;
  display: block;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.sp-avatar.sp-logo { padding: 24px; box-sizing: border-box; }
.sp-name { font-size: 22px; font-weight: 800; color: #1c1c1e; margin: 0; }
.sp-handle { font-size: 13.5px; color: #8e8e93; margin: 3px 0 14px; }
.sp-bio { font-size: 13.5px; line-height: 1.6; color: #3a3a3c; margin: 0 auto 18px; max-width: 460px; }
.sp-stats { display: flex; justify-content: center; gap: 26px; margin-bottom: 20px; flex-wrap: wrap; }
.sp-stats div { text-align: center; }
.sp-stats b { display: block; font-size: 17px; color: #1c1c1e; }
.sp-stats span { font-size: 11.5px; color: #8e8e93; }
.sp-btn {
  display: inline-block;
  color: #fff; text-decoration: none;
  font-size: 13.5px; font-weight: 700;
  padding: 9px 26px; border-radius: 22px;
  border: none; cursor: pointer;
}
.sp-btn:hover { filter: brightness(1.08); }
.sp-note { font-size: 11px; color: #b0b0b5; margin-top: 22px; }
.sp-articles { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.sp-article {
  display: block; text-decoration: none;
  border: 1px solid #e5e5ea; border-radius: 10px; overflow: hidden;
  background: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.sp-article:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.1); }
.sp-article img { width: 100%; height: 86px; object-fit: cover; display: block; background: #f2f2f7; }
.sp-article div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: #1c1c1e; line-height: 1.35; }
.sp-loading { padding: 60px 0; text-align: center; color: #8e8e93; font-size: 13px; }

/* ============ PDF (Preview) ============ */
#win-pdf { width: 760px; height: 640px; background: #323236; }
.pdf-body { flex: 1; min-height: 0; background: #323236; }
#pdf-frame { width: 100%; height: 100%; border: none; display: block; background: #323236; }

/* ============ YOUTUBE PLAYER ============ */
#win-youtube { width: 860px; height: 540px; background: #0f0f0f; }
.yt-body { flex: 1; min-height: 0; background: #000; }
#yt-frame { width: 100%; height: 100%; border: none; display: block; background: #000; }

/* ============ DOCK ============ */
#dock-wrap {
  position: fixed; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center;
  z-index: 5500;
  pointer-events: none;
}
#dock {
  pointer-events: auto;
  display: flex; align-items: flex-end; gap: 7px;
  padding: 7px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .22);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border: .5px solid rgba(255,255,255,.35);
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
  max-width: calc(100vw - 16px);
  overflow: visible; /* icons pop above the glass pill when magnified */
  scrollbar-width: none;
}
#dock::-webkit-scrollbar { display: none; }
.dock-item {
  position: relative;
  width: 46px; height: 46px;
  border: none; background: none; padding: 0;
  cursor: pointer;
  transition: transform .12s ease;
  transform-origin: 50% 100%; /* grow upward, layout size stays fixed */
  flex: 0 0 auto;
  display: block;
}
.dock-item svg, .dock-item img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.3)); }
.dock-item .dock-dot {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: rgba(20,20,20,.75);
  opacity: 0; transition: opacity .2s;
}
.dock-item.running .dock-dot { opacity: 1; }
.dock-item .dock-tip {
  position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  background: rgba(50, 50, 55, .85); color: #fff;
  backdrop-filter: blur(10px);
  font-size: 12px; font-weight: 500;
  padding: 4px 11px; border-radius: 7px;
  white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.dock-item:hover .dock-tip { opacity: 1; }
.dock-item.bouncing { animation: dockBounce .55s ease; }
@keyframes dockBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-22px); }
}
.dock-sep {
  width: 1px; align-self: stretch; margin: 4px 3px;
  background: rgba(255,255,255,.35);
  flex: 0 0 auto;
}

/* ============ CALENDAR WIDGET ============ */
.widget-cal {
  position: absolute; top: 22px; left: 22px;
  width: 176px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: .5px solid rgba(255,255,255,.55);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  padding: 13px 14px 12px;
  z-index: 5;
}
.wc-head {
  font-size: 12px; font-weight: 800; color: #e5484d;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.wc-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px 0;
  text-align: center;
}
.wc-dow { font-size: 8.5px; font-weight: 700; color: #8e8e93; padding-bottom: 2px; }
.wc-day {
  font-size: 10.5px; color: #1c1c1e;
  height: 18px; line-height: 18px;
  border-radius: 50%;
}
.wc-day.other { color: #b6b6bb; }
.wc-day.today { background: #e5484d; color: #fff; font-weight: 700; }

/* ============ WORLD TIME WIDGET ============ */
.widget-wt {
  position: absolute; top: 214px; left: 22px;
  width: 176px;
  border-radius: 18px;
  background: rgba(30, 32, 40, .62);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: .5px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  padding: 14px 10px 11px;
  display: flex; justify-content: space-around; gap: 6px;
  z-index: 5;
}
.wt-clock { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.wt-face {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, #ffffff, #eef0f4 70%, #e3e6ec 100%);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.9),
    inset 0 -2px 6px rgba(0,0,0,.08),
    0 4px 12px rgba(0,0,0,.35);
  position: relative;
}
/* ticks are generated by JS */
.wtk {
  position: absolute; left: calc(50% - 0.75px); top: 3px;
  width: 1.5px; height: calc(100% - 6px);
  background: linear-gradient(#c2c6cf 0 4px, transparent 4px);
  border-radius: 1px;
  pointer-events: none;
}
.wtk.main { width: 2.5px; left: calc(50% - 1.25px); background: linear-gradient(#3a3a3f 0 6px, transparent 6px); }
.wh {
  position: absolute; left: 50%; bottom: 50%;
  transform-origin: 50% 100%;
  border-radius: 3px;
  background: #1c1c1e;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.wh-h { width: 3.5px; height: 15px; margin-left: -1.75px; }
.wh-m { width: 2.5px; height: 22px; margin-left: -1.25px; }
.wh-s { width: 1.3px; height: 26px; margin-left: -.65px; background: #ff9f0a; box-shadow: none; }
.wt-dot {
  position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #ff9f0a;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.wt-city {
  font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  max-width: 80px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: none; border: none; padding: 0; font-family: inherit;
}
.wt-editable { cursor: pointer; }
.wt-editable:hover { color: #9fd1ff; }
.wt-digital { font-size: 10px; color: rgba(255,255,255,.65); font-variant-numeric: tabular-nums; }
#wt-city-select {
  font-size: 10.5px; max-width: 84px;
  border-radius: 5px; border: none;
  background: rgba(255,255,255,.9);
}

/* ============ MAIL ============ */
#win-mail { width: 560px; height: 460px; }
.mail-titlebar { background: linear-gradient(#fdfdfd, #f1f1f3); }
.mail-send {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 26px; border-radius: 6px;
  border: none; cursor: pointer;
  background: #2f7cf6; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.mail-send:hover { background: #1e6ae4; }
.mail-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #fff; }
.mail-field {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  font-size: 13px;
}
.mail-field label { color: #8e8e93; flex: 0 0 auto; }
.mail-field input {
  flex: 1; border: none; outline: none;
  font: inherit; color: #1c1c1e;
  background: none;
}
.mail-chip {
  background: #e8f0fe; color: #1a56c4;
  border-radius: 12px;
  padding: 2px 11px;
  font-size: 12.5px; font-weight: 600;
}
#mail-message {
  flex: 1; resize: none; border: none; outline: none;
  padding: 14px 16px;
  font: inherit; font-size: 13.5px; line-height: 1.6; color: #1c1c1e;
  background: none;
}
.mail-hint {
  padding: 6px 16px 10px;
  font-size: 10.5px; color: #b0b0b5;
}

/* ============ WINDOW RESIZE HANDLES ============ */
.rz { position: absolute; z-index: 40; }
.rz-n  { top: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.rz-s  { bottom: 0; left: 12px; right: 12px; height: 5px; cursor: ns-resize; }
.rz-e  { right: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.rz-w  { left: 0; top: 12px; bottom: 12px; width: 5px; cursor: ew-resize; }
.rz-ne { top: 0; right: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.rz-sw { bottom: 0; left: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.rz-nw { top: 0; left: 0; width: 13px; height: 13px; cursor: nwse-resize; }
.rz-se { bottom: 0; right: 0; width: 13px; height: 13px; cursor: nwse-resize; }
.window.maximized .rz { display: none; }

/* ============ HINT ============ */
.hint {
  position: fixed; bottom: calc(var(--dock-h) + 26px); left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,35,.7); color: #fff;
  backdrop-filter: blur(14px);
  font-size: 12.5px; padding: 8px 18px; border-radius: 20px;
  z-index: 4000;
  transition: opacity .8s ease;
  pointer-events: none;
  white-space: nowrap;
}
.hint.gone { opacity: 0; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .xc-simulator { width: 220px; }
  .xc-navigator { width: 180px; }
}

@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  :root { --dock-h: 60px; }
  #dock { overflow-x: auto; }
  .widget-cal, .widget-wt { display: none; }
  .rz { display: none; }

  #desktop-icons { right: 6px; gap: 4px; }
  .desk-icon { width: 84px; }
  .di-img { width: 46px; height: 46px; }

  .window:not(.maximized) {
    left: 2vw !important; top: 2vh !important;
    width: 96vw !important;
    height: calc(96vh - var(--menubar-h) - var(--dock-h)) !important;
  }
  .xc-navigator { display: none; }
  .xc-breadcrumb { display: none; }
  .xc-mobile-bar {
    display: block;
    background: #26262b;
    border-bottom: 1px solid #000;
    flex: 0 0 auto;
  }
  .xcode-body { flex-direction: column; }
  /* One pane at a time: Code by default, Preview via toggle */
  .xc-editor { flex: 1; min-height: 0; }
  .xc-simulator { display: none; }
  #win-xcode.show-sim .xc-editor { display: none; }
  #win-xcode.show-sim .xc-simulator {
    display: flex; flex: 1; min-height: 0;
    width: 100%; border-left: none;
  }
  .sim-stage { padding: 12px; }
  .xc-status { display: none; }
  .dock-item { width: 40px; height: 40px; }
  .hint { font-size: 11px; }
}
