/* ==========================================================================
   STYLE
   1. Settings        6. Dock
   2. Base            7. Windows
   3. Wallpaper       8. Window contents
   4. Menu bar        9. Intro animation
   5. Desktop icons  10. Reduced motion
   ========================================================================== */


/* ---------- 1. Settings: change the look here ---------- */

:root {
  --ink: #1d1d1f;
  --muted: #86868b;
  --accent: #2f6bff;                 /* selection, links, buttons */
  --desktop: #dcdad6;                /* shows while the photo loads */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;

  --thumb: 62px;                     /* desktop thumbnail size */
  --cell: 88px;                      /* width of one desktop icon */
  --dock-icon: 50px;

  --ease: cubic-bezier(.16, 1, .3, 1);       /* smooth ease-out, used almost everywhere */
  --spring: cubic-bezier(.34, 1.56, .64, 1); /* slight overshoot, for things that settle */
  --glass: blur(24px) saturate(1.6);
}

@media (max-width: 640px) {
  :root { --thumb: 46px; --cell: 72px; --dock-icon: 42px; }
}


/* ---------- 2. Base ---------- */

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

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

body {
  font: 13px/1.4 var(--font);
  color: var(--ink);
  background: var(--desktop);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.noscript { position: fixed; inset: 0; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--desktop); }
.noscript a { color: var(--accent); }


/* ---------- 3. Wallpaper ---------- */

.wallpaper { position: fixed; inset: 0; overflow: hidden; }

.wallpaper img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scale: 1.05;                                   /* room for the parallax to move */
  translate: calc(var(--mouse-x, 0) * -22px) calc(var(--mouse-y, 0) * -14px);
  animation: wallpaper-in 1.1s var(--ease);
}
@keyframes wallpaper-in { from { filter: blur(14px); scale: 1.12; } }

/* film grain over everything */
.wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .14;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}


/* ---------- 4. Menu bar, dropdowns, status widget ---------- */

.menubar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 9500;
  height: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  background: rgba(255, 255, 255, .42);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}
#menus { display: flex; align-items: center; height: 100%; }
.menu { position: relative; }
.menu-title { height: 22px; padding: 0 10px; border-radius: 5px; display: flex; align-items: center; }
.menu.bold .menu-title { font-weight: 700; }
.menu.open .menu-title { background: rgba(0, 0, 0, .1); }
@media (max-width: 640px) { .menu.desktop-only { display: none; } } /* the Dock covers these on phones */

.status { display: flex; align-items: center; gap: 14px; padding-right: 6px; font-variant-numeric: tabular-nums; }
.status svg { display: block; }

.dropdown {
  position: absolute;
  top: 25px;
  left: 0;
  min-width: 230px;
  padding: 5px;
  border-radius: 9px;
  background: rgba(242, 242, 242, .86);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), 0 12px 36px rgba(0, 0, 0, .22);
  transform-origin: 0 0;
}
.dropdown:not([hidden]) { animation: dropdown-in .22s var(--ease); }
@keyframes dropdown-in { from { opacity: 0; translate: 0 -4px; scale: .97; } }
.dropdown hr { border: 0; border-top: 1px solid rgba(0, 0, 0, .12); margin: 5px 10px; }
.context-menu { position: fixed; z-index: 9600; }

.menu-item { display: flex; width: 100%; padding: 3px 10px; border-radius: 5px; text-align: left; }
.menu-item:hover,
.menu-item:focus-visible { background: var(--accent); color: #fff; outline: none; }

.widget {
  position: fixed;
  top: 40px;
  left: 16px;
  z-index: 0;                     /* below the files, so nothing can hide under it */
  width: 228px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .44);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .6) inset, 0 8px 30px rgba(0, 0, 0, .12);
}
.widget .name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.widget .role { color: #48484a; margin-bottom: 10px; }
.widget .row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #3a3a3c; }
.widget .hint { margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(0, 0, 0, .08); font-size: 11.5px; color: #48484a; }
.available-dot { width: 7px; height: 7px; border-radius: 50%; background: #28c840; box-shadow: 0 0 0 3px rgba(40, 200, 64, .2); }

.touch-only { display: none; }
@media (hover: none) { .mouse-only { display: none; } .touch-only { display: inline; } }

@media (max-width: 640px) {
  .widget { width: auto; padding: 10px 13px; border-radius: 16px; }
  .widget .role, .widget .hint { display: none; }
}


/* ---------- 5. Desktop icons ---------- */

#desk { position: fixed; inset: 0; z-index: 1; touch-action: none; }

.icon {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cell);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px;
  touch-action: none;
  transition: opacity .35s, rotate .35s var(--spring);
}
#desk.loading .icon { opacity: 0; }
#desk.animating .icon { transition: transform .62s var(--ease), opacity .35s, rotate .35s var(--spring); }

/* depth: each file drifts with the mouse by its own --depth, and bobs on its own phase */
#desk .icon { translate: calc(var(--mouse-x, 0) * var(--depth, 10) * 1px) calc(var(--mouse-y, 0) * var(--depth, 10) * 1px); }
#desk .icon > * { animation: float 6s ease-in-out var(--float-delay, 0s) infinite alternate; }
@keyframes float { to { translate: 0 -4px; } }

.thumb {
  width: calc(var(--thumb) + 8px);
  height: calc(var(--thumb) + 8px);
  display: grid;
  place-items: center;
  border-radius: 5px;
  transition: scale .35s var(--spring), filter .25s, background .15s;
}
.thumb .art {
  max-width: var(--thumb);
  max-height: var(--thumb);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  transition: translate .35s var(--ease), box-shadow .35s var(--ease);
}
.thumb svg { width: var(--thumb); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
@media (hover: hover) {
  #desk .icon:hover .art { translate: 0 -3px; box-shadow: 0 8px 18px rgba(0, 0, 0, .35); }
}

.label {
  max-width: 100%;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 4px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .9);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: background .15s;
}

.icon.selected .thumb { background: rgba(0, 0, 0, .26); }
.icon.selected .label { background: var(--accent); text-shadow: none; }
.icon.lifted .thumb { scale: 1.12; filter: drop-shadow(0 14px 14px rgba(0, 0, 0, .3)); }
.icon:focus-visible { outline: none; }
.icon:focus-visible .thumb { outline: 2px solid var(--accent); }

#marquee { position: fixed; z-index: 2; border: 1px solid rgba(47, 107, 255, .8); background: rgba(47, 107, 255, .14); pointer-events: none; }


/* ---------- 6. Dock ----------
   The hovered icon and its neighbours really grow (width, not scale),
   so the row slides apart like the macOS dock. */

.dock {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 9000;
  height: calc(var(--dock-icon) + 12px);
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px;
  border-radius: 20px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .34);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .55) inset, 0 10px 30px rgba(0, 0, 0, .18);
}
.dock button { position: relative; flex: none; width: var(--dock-icon); aspect-ratio: 1; transition: width .5s var(--ease); }
.dock button svg { display: block; width: 100%; height: 100%; }
.dock .divider { align-self: stretch; width: 1px; margin: 4px 2px; background: rgba(0, 0, 0, .14); }

@media (hover: hover) {
  /* two away */
  .dock > :hover + * + button,
  .dock > button:has(+ * + :hover) { width: calc(var(--dock-icon) * 1.14); }
  /* next to it */
  .dock > :hover + button,
  .dock > :hover + .divider + button,
  .dock > button:has(+ :hover),
  .dock > button:has(+ .divider + :hover) { width: calc(var(--dock-icon) * 1.32); }
  /* the hovered one */
  .dock > button:hover { width: calc(var(--dock-icon) * 1.6); }

  .dock button::before {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    translate: -50% 0;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    color: #fff;
    background: rgba(30, 30, 30, .8);
    opacity: 0;
    pointer-events: none;
    transition: translate .5s var(--ease), opacity .3s var(--ease);
  }
  .dock button:hover::before { opacity: 1; translate: -50% -12px; }
}

.dock button.running::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: rgba(0, 0, 0, .6); }
.dock button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.dock .bounce svg { animation: bounce .6s var(--ease); }
@keyframes bounce { 35% { translate: 0 -18px; } }

@media (max-width: 640px) {
  .dock { gap: 5px; padding: 5px; height: calc(var(--dock-icon) + 10px); border-radius: 17px; }
}


/* ---------- 7. Windows ---------- */

.win {
  position: fixed;
  width: min(var(--win-width, 640px), calc(100vw - 24px));
  max-height: calc(100dvh - 130px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .2), 0 12px 36px rgba(0, 0, 0, .2);
  outline: none;
  transition: rotate .3s var(--spring);
}
.win.front { box-shadow: 0 0 0 .5px rgba(0, 0, 0, .28), 0 24px 70px rgba(0, 0, 0, .34); }
.win.zoomed { left: 0 !important; top: 28px !important; width: 100vw; height: calc(100dvh - 28px); max-height: none; border-radius: 0; }
::view-transition-group(*) { animation-duration: .36s; animation-timing-function: var(--ease); }

.titlebar {
  position: relative;
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  background: #f2f2f2;
  border-bottom: 1px solid #dedede;
  touch-action: none;
}
.titlebar h2 {
  position: absolute;
  inset: 0 90px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #3a3a3c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.lights { z-index: 1; display: flex; gap: 8px; }
.light { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .18); }
.light.minimize { background: #febc2e; }
.light.zoom { background: #28c840; }
.win:not(.front) .light { background: #d4d4d4; }
.light:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.win-body { flex: 1; overflow: auto; overscroll-behavior: contain; user-select: text; -webkit-user-select: text; }


/* ---------- 8. Window contents ---------- */

/* project */
.preview { display: grid; place-items: center; padding: 32px 24px; background: #161616; perspective: 1000px; }
.preview .art { max-width: 100%; max-height: min(42vh, 420px); box-shadow: 0 10px 40px rgba(0, 0, 0, .5); transition: transform .5s var(--ease); }

.info { display: grid; grid-template-columns: 1.7fr 1fr; gap: 28px; padding: 24px 28px 30px; }
.info h3 { margin: 6px 0 12px; font-size: 30px; line-height: 1.05; letter-spacing: -.025em; }
.info p { font-size: 14px; line-height: 1.6; color: #3a3a3c; }
.info dl { display: grid; grid-template-columns: auto 1fr; align-content: start; gap: 6px 14px; padding-top: 22px; font-size: 12px; }
.info dt { color: var(--muted); }
.kicker { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.visit { display: inline-block; margin-top: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }

.pager { display: flex; justify-content: space-between; padding: 0 28px 22px; }
.pager button { font-weight: 600; color: var(--accent); cursor: pointer; }

@media (max-width: 640px) {
  .info { grid-template-columns: 1fr; gap: 4px; padding: 20px; }
  .info dl { padding-top: 12px; }
  .info h3 { font-size: 25px; }
  .pager { padding: 0 20px 18px; }
}

/* folder */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 6px; padding: 20px 14px; }
.folder-grid .icon { position: static; width: auto; cursor: pointer; }
.folder-grid .label { color: var(--ink); text-shadow: none; font-weight: 500; }
.folder-grid .icon:hover .thumb { background: rgba(0, 0, 0, .06); }
.statusbar { position: sticky; bottom: 0; padding: 6px 12px; font-size: 11px; text-align: center; color: var(--muted); background: #fafafa; border-top: 1px solid #e8e8e8; }

/* trash */
.list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.list th { padding: 7px 14px; text-align: left; font-size: 11px; font-weight: 500; color: var(--muted); border-bottom: 1px solid #e5e5e5; }
.list td { padding: 5px 14px; white-space: nowrap; }
.list td:first-child { white-space: normal; }
.list tbody tr:nth-child(even) { background: #f5f5f7; }

/* text documents: about, help, résumé */
.doc { padding: 26px 32px 34px; font-size: 14px; line-height: 1.62; color: #2c2c2e; }
.doc h3 { margin-bottom: 10px; font-size: 25px; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
.doc h4 { margin: 22px 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc p + p { margin-top: 10px; }
.doc ul { padding-left: 18px; }
.doc li + li { margin-top: 4px; }
.doc .date { margin-bottom: 16px; font-size: 11px; text-align: center; color: #a1a1a6; }
.win.notes .titlebar { background: #fbf6e2; border-color: #ece3c0; }

.win.pdf .win-body { padding: 18px; background: #7c7c80; }
.page { padding: 34px 36px; font-size: 13px; background: #fff; box-shadow: 0 4px 20px rgba(0, 0, 0, .3); }
.page header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.page header b { font-size: 26px; line-height: 1; letter-spacing: -.03em; }
.cv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; }
.cv dt { color: var(--muted); font-variant-numeric: tabular-nums; }
.cv dd b { display: block; color: var(--ink); }

@media (max-width: 640px) {
  .doc { padding: 20px; }
  .page { padding: 22px 20px; }
  .cv { grid-template-columns: 1fr; gap: 0; }
  .cv dd { margin-bottom: 10px; }
}

/* contact */
.mail .row { display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-bottom: 1px solid #ececec; }
.mail .row span { width: 58px; color: var(--muted); }
.mail input,
.mail textarea { flex: 1; border: 0; background: none; font: inherit; color: inherit; outline: none; }
.mail textarea { display: block; width: 100%; min-height: 170px; padding: 16px 18px; line-height: 1.55; resize: vertical; }
.mail-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; background: #fafafa; border-top: 1px solid #ececec; }
.mail-footer a { margin-right: 14px; color: var(--accent); text-decoration: none; }
.mail-footer a:hover { text-decoration: underline; }
.send { padding: 6px 18px; border-radius: 7px; font-weight: 600; color: #fff; background: var(--accent); cursor: pointer; }
.send:focus-visible,
.pager button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* ---------- 9. Intro animation ---------- */

.menubar { animation: menubar-in .5s var(--ease) .05s backwards; }
@keyframes menubar-in { from { translate: 0 -100%; } }

.widget { animation: rise-in .55s var(--ease) .22s backwards; }
@keyframes rise-in { from { opacity: 0; translate: 0 16px; } }

.dock { animation: dock-in .6s var(--ease) .32s backwards; }
@keyframes dock-in { from { opacity: 0; translate: 0 60px; } }


/* ---------- 10. Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
